delete属性删除
- 不能删除全局变量和局部变量
var globalVal = 1;
delete globalVal; // false
(function(){
var localVal = 1;
return delete localVal;
}()); // false
- 不能删除函数
function fd(){}
delete fd; // false
(function(){
function fd(){};
return delete fd;
}());//false
- 可以删除隐式全局变量
ohNo = 1;
console.log(window.ohNo); // 1
delete ohNo; //true
文章名称:delete属性删除
标题网址:http://azwzsj.com/article/jdoogd.html