1、Javascript 共有 6 种数据类型:
(基本类型 5 种)number、string、boolean、null、undefined
。
(引用类型 1 种) object
。
2、typeof 检测返回 6 种: undefined、boolean、string、number、object、function
注: null 是一个只有一个值的特殊类型,表示一个空对象引用,用 typeof 检测返回是 object。
3、常见举例如下:
typeof( undefined ) // undefined
typeof(null) // object
typeof(0) // number
typeof(false) // boolean
typeof("") // string