Array.isArray()
Determines whether the passed value is an Array.
Syntax
Array.isArray(value) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
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
| Environment | Since version |
|---|---|
| chrome | 5 |
| firefox | 4 |
| safari | 5 |
| edge | 12 |
| node | 0.10 |