Latest web development tutorials
 

JavaScript Array isArray() Method

< JavaScript Array Reference

Example

Check whether an object is an array:

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

The result will be:

true
Try it Yourself »

Definition and Usage

The isArray() method determines whether an object is an array.

This function returns true if the object is an array, and false if not.


Browser Support

Method
isArray() 5 9.0 4 5 10.5

Syntax

Array.isArray(obj)

Parameter Values

Parameter Description
obj Required. The object to be tested

Technical Details

Return Value: A Boolean. Returns true if the object is an array, otherwise it returns false
JavaScript Version: 1.8.5

< JavaScript Array Reference