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