0

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

1
  • 2
    arrays are objects. You can type Array.isArray(array) in your console instead. Commented Feb 16, 2022 at 16:12

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.