The isArray() method determines whether an object is an array.
The isArray() method determines whether an object is an array.
This function returns true if the object is an array, and false otherwise.
Array.isArray(obj)
Parameter | Require | Description |
---|---|---|
obj | Required. | The object to be tested |
A Boolean. Returns true if the object is an array, otherwise it returns false.
Check whether an object is an array:
var myArray = ["XML", "Json", "Database", "Mango"]; console.log(Array.isArray(myArray)); console.log(Array.isArray("asdf")); console.log(Array.isArray(null));