- typeof 其中数组 对象 null都会判断为Object,其他正确
typeof 2 // number
typeof true //bolean
typeof 'str' //string
typeof [] //Object
typeof function (){} // function
typeof {} //object
typeof undefined //undefined
typeof null // null
- instanceof 判断引用类型,其内部机制就是判断其原型链上是否存在该类型的原型
2 instanceof Number //false
true instanceof Boolean //false
'str' instanceof String //false
[] instanceof Array //true
{} instanceof Object //true
function(){} instanceof Function //true
- constructor 对象访问它构造函数
(2).constructor === Number //true
(true).constructor ==Boolean //true
- Object.prototype.toString.call()
Object.prototype.toString.call(2) == '[object Number]'