How to define the dynamic array in JavaScript

Today we are going to learn How to define a dynamic array in JavaScript. There are many scenario’s when we have to define dynamic array in our web application.

Sample

var arr = [];
for(var i=1; i<=mynumber; i++) {
   arr.push(i.toString());
}

Facebooktwittergoogle_plusredditpinterestlinkedinmail
1 Star2 Stars3 Stars4 Stars5 Stars (13 votes, average: 5.00 out of 5)
Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *