Javascript Dynamic Array

--

One of the many features that make JavaScript a useful language is its ability to work with dynamic arrays. Other programming languages such as c, c++, etc have to tell a range of array sizes, javascript does not need to tell you the array size. Dynamic arrays are arrays that can change in size as needed during runtime.This means that you don’t have to specify a fixed size .

const myArray = [1, 2, 3]; //size length 3
myArray.push(4)
myArray.push(5)
console.log(myArray); // Output: [1, 2, 3, 4, 5]
console.log(myArray.length) // Output : 5

Dynamic arrays in JavaScript can be incredibly powerful and allow you to work with data in a much more flexible and efficient way.

--

--

No responses yet