1、对象属性删除
<script> function fun(){ this.name = ‘mm‘; } var obj = new fun(); console.log(obj.name);//mm delete obj.name; console.log(obj.name); //undefined </script>
2、变量删除
<script> var name = ‘lily‘; delete name; console.log(name); //name is not defined </script>
3、对象原型设置的属性无法删除
<script> function Person() { } Person.prototype.say=‘hello‘; var p=new Person(); console.log(p.say);//hello delete p.say; console.log(p.say);//hello </script>