Posted in Javascript onAugust 24, 2014
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
js delete 用法(删除对象属性及变量)
- Author -
whsnow声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@