Array.isArray()

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

Array.isArray(obj)

obj : Required. The object to be tested.


Examples:

        Array.isArray() // false
        Array.isArray([]); // true
        Array.isArray('List'); // true
        Array.isArray(new Array()); // true
        Array.isArray(null); // false
        Array.isArray(true); //false
        Array.isArray([1]); // true
        Array.isArray({}); // false
        Array.isArray(undefined); // false
        Array.isArray(25); // false

2 thoughts on “Array.isArray()

Add yours

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started