Monday, October 6, 2025
HomeLanguagesJavascriptJavaScript Array isArray() Method

JavaScript Array isArray() Method

The Javascript arr.isArray() method determines whether the value passed to this function is an array or not. This function returns true if the argument passed is an array else it returns false.

Syntax:

Array.isArray(obj)

Parameters: This method accepts a single parameter as mentioned above and described below:

  • obj: This parameter holds the object that will be tested.

Return value: This function returns the Boolean value true if the argument passed is an array otherwise it returns false. 

Below is an example of the Array isArray() method.

Example 1: In this example, we will pass a string value to the isArray() and check what value is returned.

JavaScript




// JavaScript code for isArray() function
function func() {
    console.log(Array.isArray('foobar'));
}
 
func();


Output:

false

Example 2: Since the argument passed to the function isArray() is an array therefore this function returns true as the answer.

JavaScript




// JavaScript code for isArray() function
function func() {
    console.log(Array.isArray(['Day', 'Night', 'Evening']));
}
func();


Output:

true

Example 3: Since the argument passed to the function isArray() is a map therefore this function returns false as the answer.

JavaScript




// JavaScript code for isArray() function
function func() {
    console.log(Array.isArray({ foo: 123 }));
}
func();


Output:

false

Example 4: Since the argument passed to the function isArray() is a string, therefore, this function returns false as the answer.

Javascript




// JavaScript code for isArray() function
function func() {
    console.log(Array.isArray({ foo: 123 }));
}
func();


Output:

false

We have a complete list of Javascript Array methods, to check those please go through this Javascript Array Complete reference article.

Supported Browsers: The browsers supported by JavaScript Array isArray() method are listed below:

  • Google Chrome 5.0
  • Microsoft Edge 12
  • Mozilla Firefox 4.0
  • Safari 5.0
  • Opera 10.5

We have a Cheat Sheet on Javascript where we covered all the important topics of Javascript to check those please go through Javascript Cheat Sheet-A Basic guide to JavaScript. 

RELATED ARTICLES

Most Popular

Dominic
32338 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6707 POSTS0 COMMENTS
Nicole Veronica
11871 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6825 POSTS0 COMMENTS
Ted Musemwa
7089 POSTS0 COMMENTS
Thapelo Manthata
6779 POSTS0 COMMENTS
Umr Jansen
6779 POSTS0 COMMENTS