0
点赞
收藏
分享

微信扫一扫

js 判断未定义字段

吴陆奇 2022-08-02 阅读 94


 

介绍

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 判断未定义字段_双引号

 

 

举报

相关推荐

0 条评论