类型

typeof 是用于在 javascript 中获取 type 的官方函数,但在某些情况下它可能会产生一些意想不到的结果……

1.字符串

typeof "String" 或
typeof Date(2011,01,01)

字符串

2.数字

typeof 42

数

布尔

typeof true(有效值 true 和 false)

布尔

4.对象

typeof {} 或
typeof [] 或
typeof null 或
typeof /aaa/或
typeof Error()

宾语

5.功能

typeof function(){}

功能

6.未定义

var var1; typeof var1

不确定