Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / JavaScript

Array.isArray: reliable array detection

Array.isArray performs the internal Array brand test instead of guessing from prototype, constructor, or object shape.

Version: ECMAScript 2026 draft; example target: Node.js 24.22.2

Syntax

Array.isArray(value)

Array.isArray(value) returns true only for an object carrying the internal Array brand, including Array subclasses and arrays from another realm. It returns false for array-like objects, arguments, and typed arrays, and does not coerce the value.

It is safer than value instanceof Array, which can fail across windows or iframes. A normal proxy around an array follows its target, while testing a revoked proxy can throw TypeError.

The function accepts the value itself and otherwise returns a Boolean. The example distinguishes a real Array subclass from a typed array and an object that merely looks array-like.

Examples

class List extends Array {}
console.log(Array.isArray(new List(1, 2)));
console.log(Array.isArray(new Uint8Array(2)));
console.log(Array.isArray({0: "a", length: 1}));

Result

true
false
false

Sources