`(function(x){
delete x;
return x;
})(1)//为什么返回1,不是delete了吗?`
var x = 1;
if(function f(){}){
x += typeof f;
}
x;//为嘛返回 1underfind?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
delete删除的是属性不是变量。
转换为boolean值,楼上说的很对+1。
if(function f(){}){
alert(typeof f); //undefined
}
&
function f(){}
alert(typeof f); //function
作用域不同,前者不在全局作用域中,所以取不到