189 8069 5689

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://cdxtjz.cn/article/jdoogd.html

其他资讯