Skip to main content
Version: 3.13.0

Array.isArray()

The Array.isArray() static method determines whether the passed value is an Array.

Syntax

Array.isArray(value)

Parameters

  • value
    • : The value to be checked.

Return value

true if value is an Array; otherwise, false. false is always returned if value is a TypedArray instance.

Description

Array.isArray() checks if the passed value is an Array. It does not check the value's prototype chain, nor does it rely on the Array constructor it is attached to. It returns true for any value that was created using the array literal syntax or the Array constructor. This makes it safe to use with cross-realm objects, where the identity of the Array constructor is different and would therefore cause instanceof Array to fail.

See the article "Determining with absolute accuracy whether or not a JavaScript object is an array" for more details.

Array.isArray() also rejects objects with Array.prototype in its prototype chain but aren't actual arrays, which instanceof Array would accept.