Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 861 Bytes

Array.isArray.md

File metadata and controls

36 lines (29 loc) · 861 Bytes

Array.isArray

The Array.isArray() method returns true if an object is an array, false if it is not.

Syntax

Array.isArray(obj)

Parameters

obj The object to be checked.

MDN link | MSDN link

Examples

// all following calls return true
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
// Little known fact: Array.prototype itself is an array:
Array.isArray(Array.prototype); 

// all following calls return false
Array.isArray();
Array.isArray({});
Array.isArray(null);
Array.isArray(undefined);
Array.isArray(17);
Array.isArray('Array');
Array.isArray(true);
Array.isArray(false);
Array.isArray({ __proto__: Array.prototype });