Javatpoint Logo
Javatpoint Logo

jQuery isArray() method

The isArray() method is used to test whether the passed argument is an array or not. This method returns a Boolean value. If it finds the passed value is an array, it returns true. Otherwise, it returns false.

Syntax

This method accepts a single parameter, which is defined as follows -

obj - It is any object to test whether it is an array or not.

Let's understand the working of the isArray() method, using some illustrations.

Example1

In this example, we are using the isArray() method to determine whether the passed arguments are array or not. Here, we are passing curly braces {}, and square brackets [] as an argument.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery isArray() method

Example2

In this example, we are using the isArray() method for checking different values to see whether the method returns true or false. We are defining an array arr for which the method returns true, and for other values such as undefined, null, true, isArray() method will return false.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery isArray() method




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA