Check if value is array in JavaScript
instanceof Array
js
[] instanceof Array // true"test" instanceof Array // false
Array.isArray
As of ES5 there is now also:
js
Array.isArray([]) // trueArray.isArray("test") // falseArray.isArray({}) // false
.constructor === Array
js
[].constructor === Array // true"foo".constructor === Array // false
From Stack Overflow