How to determine whether an object is an array,

How to determine whether an object is an array? Is a more common problem. I summarize the four methods of the chain, as follows.

The First method

Array.prototype.isPrototypeOf(obj) // Determine if the Array is on the prototype object of obj. Return true/false

The Second method

obj instanceof Array //return true/false

The Third method

Object.prototype.toString.call(obj) //return [Object Array]

The Fourth method

Array.isArray (obj) // There are compatibility issues 

personally recommend the third method. The return is clearer. It is possible to clearly determine what type of current object is not only to determine the array.