介绍
1.abc 要用typeof() 里边才好使
2.undefined 要加双引号
ok
代码
var abc = {a:"ss"};
var as = abc.aa;
if(typeof(as) == "undefined"){
console.log(1)
}else{
console.log(2)
}
//显示1
图片
微信扫一扫
1.abc 要用typeof() 里边才好使
2.undefined 要加双引号
ok
var abc = {a:"ss"};
var as = abc.aa;
if(typeof(as) == "undefined"){
console.log(1)
}else{
console.log(2)
}
//显示1
相关推荐