js中几个需要注意的数据类型
Undefined
Undefined类型只有一个值。即undefined.
---所有已申明而没有初始化的变量,默认值都为undefined
---函数没有明确返回值的时候,会默认返回undefined
---null也是object类型的一种
var s;
alert(s);//underfined
function test(){
}
alert(test());//underfined
Null
Null类型只有一个值,即null
---undefined从null派生而来,二者值相等
**---**null表示尚未存在的对象,这点和underfined定义不同
-----如何函数或方法返回值为对象,当对象不存在的情况下,返回null
alert(undefined==null);//true
alert(typeof null);//object
楼主名字不错,js的基础我也得重视。
一些小细节 得注意 了