介绍
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
图片
js 判断未定义字段
阅读 94
2022-08-02
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
相关推荐
精彩评论(0)