JavaScript: Array.isArray

By Xah Lee. Date: . Last updated: .
Array.isArray(value)
Return true if value is a true array object. Else, false.

(Array-Like Object return false.)

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

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

JavaScript: Array-Like Object

BUY ΣJS JavaScript in Depth