Javascript Array isArray()

The JavaScript Array isArray() method checks if the given argument is an Array or not.

The syntax of the isArray() method is:

Array.isArray(value)

The isArray() method, being a static method, is called using the Array class name.


isArray() Parameters

The isArray() method takes in:

  • value - The value to be checked.

Return value from isArray()

  • Returns true if the value is Array
  • Returns false if the value is not Array

Note: This method always returns false for TypedArray instances.


Example: Using isArray() method

value1 = "JavaScript";
console.log(Array.isArray(value1)); // false

value2 = 18;
console.log(Array.isArray(value2)); // false

value3 = true;
console.log(Array.isArray(value3)); // false

value4 = [1, 2, 3, 4];
console.log(Array.isArray(value4)); // true

value5 = new Array(3);
console.log(Array.isArray(value5)); // true

value6 = new Uint8Array(16);
console.log(Array.isArray(value6)); // false

Output

false
false
false
true
true
false