Javascript - literal array for an object?

I am reading the JavaScript The Definitive Guide and it says:

The easiest way to create an array is with an array literal

But then he says:

Another way to create an array is with the Array () constructor.

My question is, no matter how we declare the array in javascript, does it continue to be an object? thanks

+4
source share
1 answer

Yep , both objects:

typeof []; // "object"
typeof new Array(); // "object"
+6
source

Source: https://habr.com/ru/post/1610585/


All Articles