JavaScript Array isArray() method

Definition and usage

isArray() Method to determine if an object is an array.

If the object is an array, this function returns true, otherwise false.

Example

Check if the object is an array:

function myFunction() {
  var fruits = ["Banana", "Orange", "Apple", "Mango"];
  var x = document.getElementById("demo");
  x.innerHTML = Array.isArray(fruits);
}

Try it yourself

Syntax

Array.isArray(obj)

Parameter value

Parameter Description
obj Required. The object to be tested.

Technical details

Return value: Boolean value. Returns true if the object is an array, otherwise false.
JavaScript version: ECMAScript 5

Browser support

All browsers fully support isArray() Method:

Chrome IE Edge Firefox Safari Opera
Chrome 5 IE 9 Edge 12 Firefox 4 Safari 5 Opera 10.5
2010 February 2010 September 2015 July 2010 July 2010 June March 2010

Related pages

Tutorial:JavaScript array

Tutorial:JavaScript array Const

Tutorial:JavaScript array methods

Tutorial:JavaScript sorting array

Tutorial:JavaScript array iteration