typeof和instanceof的用法
typeof是一个一元运算,返回值有六种可能: "number," "string," "boolean," "object," "function," 和 "undefined."
instanceof 判断一个变量是否为某个对象的实例。
> typeof null
'object'
> null instanceof Object
'false'
> typeof true
'boolean'
> typeof 123
'number'
> typeof "abc"
'string'
> typeof function() {}
'function'
> typeof {}
'object'
> typeof []
'object'
> typeof Date
'function'
> typeof new Date()
'object'