JS: Array.isArray

By Xah Lee. Date: . Last updated: .

Array.isArray ( value )

Return true if value is a array object. (not a array-like object.) Else, false.

// real array
console.log ( Array.isArray ( ["a", "b"] ) );
// true

// array-like object
console.log ( Array.isArray ( {0:"a", 1:"b" , length:2} ) );
// false

〔►see JS: Array-Like Object

Reference

ECMAScript® 2016 Language Specification#sec-array.isarray

Array Topic

  1. JS: Array Basics
  2. JS: Understand JS Array
  3. JS: Create Array
  4. JS: Sparse Array
  5. JS: Array-Like Object
  6. JS: Array How-To

  1. JS: Array Object
  2. JS: Array.prototype
Like what you read? Buy JavaScript in Depth