Four methods are provided
1.Array.prototype.isPrototypeOf(arr)
let arr = []
console.log(Array.prototype.isPrototypeOf(arr) // true
Copy the code
2.arr.constructor === Array
let arr = []
console.log(arr.constructor === Array) // true
Copy the code
3.arr instanceof Array
Instanceof’s internal mechanism is to determine whether the prototype of the type can be found in the prototype chain of the object.
let arr = []
console.log(arr instanceof Array) // true
Copy the code
4.Array.isArray
The array. isArray method is added in ES5, but Internet Explorer 8 and below do not support it
let arr = []
console.log(Array.isArray(arr)) // true
Copy the code