Check if a Object is An Array in JavaScript

Check if An Object is An Array


In this example, you will learn to write a JavaScript program that will check if an object is an array.

To understand this example, you should have the knowledge of the following JavaScript programming topics:

Javascript Array isArray()

JavaScript Function and Function Expressions

JavaScript Array


Example: Check Array Using Array.isArray()



In the above program, the Array.isArray() method is used to check if an object is an array.

The Array.isArray() method returns true if an object is an array, otherwise returns false.

Note: For an array, the typeof operator returns an object.


For example,



Post a Comment

Previous Post Next Post