Home > front end >  Why is the type of array created using array function a object?
Why is the type of array created using array function a object?

Time:02-17

When a array is created using the array function as shown below.

Let array = Array(10);

And console logging the typeof array it shows object but why ?

I saw this.

proof image

CodePudding user response:

Arrays are also type of objects. If you want to identify if its array or not you can use Array.isArray() if you check the data types array is not defined

  • Related