数据类型

5种基本数据类型:

     Undefined
     Null
     Boolean
     Number
     String
1中复杂数据类型:
     Object
注意:
    Udefined代表没有赋值的基本数据类型
    Null代表没有赋值的引用数据类型
 
==================================
 
typeof操作符
     "undefined"——如果这个值未定义
     "boolean"——如果这个值是布尔值
     "string"——如果这个值是字符串
     "number"——如果这个值是数值
     "object"——如果这个值是对象或则null
     "function"——如果这个值是函数
注意:     
undefined 是声明了变量但未对其初始化时赋予该变量的值
null 在逻辑上说表示空的对象指针
 
值 undefined 实际上是从值 null 派生来的,因此:
alert(undefined == null); // true
但是又不完全一样,因此:
alert(undefined===null);// false
 
另外:
     var a = undefined;     // 注意 undefined 没有引号

      alert(typeof a == "undefined");     // true

// 先是 typeof a  然后在进行 == 
       var a = null;     // 注意 null 没有引号

       alert(typeof a == "null");     // false

 
posted @ 2015-04-27 11:06  Bestend  阅读(146)  评论(0)    收藏  举报