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。
本文详细解释了JavaScript中null与undefined的区别及用法,并通过示例代码展示了如何判断这两个特殊类型的值。此外还介绍了JavaScript的基本数据类型,并提到了jQuery中的is()方法。
2502

被折叠的 条评论
为什么被折叠?



