In JavaScript arrays are very important data structures one has to learn and good to be master at after learning the language basics, here in this article I would like to cover the ways to create them and arrays are common and comes handy to solve manythings
Array literal Syntax
const arr_name = []; // array without a size
const arra_name = [5]; // with size 5 elements
Literal syntax is the easy one to create,
Its most often used by developers to create arrays
supports other array operations
Array using constructor method
const arr_name = new Array(); // Array is the constructor
const arr_name = new Array(5); // Create array with 5 elements
Top comments (0)