1.删除对象属性
function fun(){
this.name = 'mm';
}
var obj = new fun();
console.log(obj.name);//mm
delete obj.name;
console.log(obj.name); //undefined
2.不能用于删除变量
var
name =
'lily'
;
delete
name;
console.log(name);
//lily
1.删除对象属性
function fun(){
this.name = 'mm';
}
var obj = new fun();
console.log(obj.name);//mm
delete obj.name;
console.log(obj.name); //undefined
var
name =
'lily'
;
delete
name;
console.log(name);
//lily