首页 > 其他 > 详细

数据类型

时间:2015-04-27 12:34:27      阅读:86      评论:0      收藏:0      [点我收藏+]

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

 

数据类型

原文:http://www.cnblogs.com/bestend/p/4459548.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!