Array.isArray()

Determines whether the passed value is an Array.

Since ES5 Spec ↗

Syntax

Array.isArray(value)

Parameters

NameTypeRequiredDescription
value any Yes The value to test.

Returns

boolean — true if the value is an Array; otherwise false.

Examples

console.log(Array.isArray([1, 2]));
Output
true
console.log(Array.isArray('abc'), Array.isArray({ length: 0 }));
Output
false false

Notes

More reliable than `instanceof Array`, which fails across iframes/realms. Returns false for array-like objects such as arguments or NodeLists.

Browser & runtime support

EnvironmentSince version
chrome 5
firefox 4
safari 5
edge 12
node 0.10

See also