var a = null;
var b;
var c = function () { }
var d = [];
console.log(typeof a);//object
console.log(typeof a);//object
console.log(typeof c);//function
console.log(typeof d);//object
//这时候我们会发现d是一个数组,但是类型却是object。
--------------------------------------------------------------------------------------
所以这里建议大家用:
toString.call()来实现复合类型的数据类型判断。