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
直接用delelte刪除不了變量
3,刪除不了原型鏈中的變量
fun.prototype.age = 18; delete obj.age; console.log(obj.age) //18