Home >>JavaScript Array Reference >JavaScript Array isArray() Method

JavaScript Array isArray() Method

JavaScript Array isArray() Method

JavaScript isArray() Method is used to determines the value passed to this method is an array. In case, if it find the argument passed is an array, the function returns true else it returns false.

Syntax:
Array.isArray(obj)

Parameter Values

Parameter Description
obj It is Required. It is the object to be tested

Browser Support

Method Chrome Edge Firefox Safari Opera
isArray() 5 9.0 4 5 10.5
Here is an example of isArray() Method:
<html>
<body>
<button onclick="myArr()">Click me</button>
<p id="isArr"></p>
<script>
function myArr() 
{
  var fruits = ["Orange", "Apple", "Bananan", "Mango"];
  var x = document.getElementById("isArr");
  x.innerHTML = Array.isArray(fruits);
}
</script>
</body>
</html>
Output:

Example 2:
<html>
<body>
<script> 
function isArray() 
{ 
 document.write(Array.isArray('toolbar')); 
} 
isArray(); 
</script> 
</body>
</html>
Output: