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://lswzjz.com/article/jdoogd.html