1、Array.isArray()
es6数组方法,判断对象是否为数组,是数组返回true,否则返回false
2、instance
A instance of B 原理上是找A的原型链上有没有B
target instanceof Array 是数组返回true
target instanceof Object 是对象返回true
3、constructor.name
判断对象的构造函数,
let a = [] a.constructor.name array
let a = {} a.constructor.name object
4、Object.prototype.toString.call()
Object.prototype.toString.call([])
"[object Array]"
Object.prototype.toString.call({})
"[object Object]"