JavaScript Array isArray() method
- Previous Page indexOf()
- Next Page join()
- Go to the Previous Level JavaScript Array Reference Manual
Definition and usage
isArray()
Method to determine if an object is an array.
If the object is an array, this function returns true, otherwise it returns 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); }
Syntax
Array.isArray(obj)
Parameter value
Parameter | Description |
---|---|
obj | Required. The object to be tested. |
Technical details
Return value: | Boolean. Returns true if the object is an array, otherwise returns 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 |
February 2010 | September 2010 | July 2015 | July 2010 | June 2010 | March 2010 |
Related Pages
Tutorial:JavaScript Array
Tutorial:JavaScript Array Const
Tutorial:JavaScript Array Methods
Tutorial:JavaScript Array Sorting
Tutorial:JavaScript Array Iteration
- Previous Page indexOf()
- Next Page join()
- Go to the Previous Level JavaScript Array Reference Manual