JavaScript isArray()Method
Examples
Determine whether 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 »
Definition and Usage
The isArray() method is used to determine whether an object is an array.
Returns true if the object is an array, otherwise returns false.
Browser Support
The numbers in the table indicate the first browser version that supports the method.
| Method | |||||
|---|---|---|---|---|---|
| isArray() | 5 | 9.0 | 4 | 5 | 10.5 |
Syntax
Array.isArray(obj)
Parameters
| Parameter | Description |
| obj | Required. The object to be judged. |
Technical Details
| Return value: | Boolean value. Returns true if the object is an array, otherwise returns false. |
|---|---|
| JavaScript Version: | ECMAScript 5 |
Other Extensions
JavaScript Array Object