判断一个值是否为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。
更多精彩文章请访问GitHub博客
无特殊声明的文章均为原创!
原创文章如若转载,请注明出处!http://www.cnblogs.com/zqzjs/
告诫自己即使再累,也不要忘记学习。成功没有捷径可走,只有一步接着一步走下去!