您好,欢迎来到微智科技网。
搜索
您的当前位置:首页判断一个值是否为null或者undefined

判断一个值是否为null或者undefined

来源:微智科技网
var a=null;
var b=undefined;
if(a===null){    //a==null
alert("a=null")
}else{
alert("a=no")
}//->a=null

if(b===undefined){  //b==undefined
alert("a=undefined")
}else{
alert("a=no")
}//->b=undefined

null与undefined是基本类型

注意:有些时候方法的返回值是"null"字符串而不是null。

6中基本类型:
    Undefined,Null,Boolean,String,Object,Number
 
扩展:jQuery中的is(selector)是遍历方法。只要有一个符合就为true。
 
 
 
 

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 7swz.com 版权所有 赣ICP备2024042798号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务