主要有typeof和instanceof。其中typeof可以检测出string, number, function, boolean, undefined,其他的都认为是object.
要确定具体的object类型需要用instanceof
要确定具体的object类型需要用instanceof
var obj1 = {}; //typeof obj1 => 'object'
var obj2 = [1, 2, 3]; // typeof obj2 => 'object'
//obj1 instanceof Array => false
//obj2 instanceof Array => true