判断对象是否是数组有那些方法?

1. isArray

const arr=[1,2,3]
console.log(Array.isArray(arr));

2. instanceof

const arr=[1,2,3]
console.log(arr instanceof Array);

3. prototype

const arr=[1,2,3]
console.log(Object.prototype.toString.call(arr).indexOf('Array')>-1);

4. isPrototypeOf

const arr=[1,2,3]
console.log(Array.prototype.isPrototypeOf(arr));

5. constructor

const arr=[1,2,3]
console.log(arr.constructor.toString().indexOf('Array')>-1);