js 数据类型及其检测方法

时间:2014-06-14 18:26:11   收藏:0   阅读:176

1.js数据类型分类:

a.基本类型:string、number、undefined、null、boolean

b.引用类型: 其他任何一种对象。Object。

 

2.typeof 操作符可以方便的检测出 string、number、undefined、boolean。

typeof 1.1;"number"
typeof ‘‘;"string"
typeof undefined;"undefined"
typeof true;"boolean"
 
而null和其他引用类型的结果都为"object"。
 
3.

js 数据类型及其检测方法,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!