Initializing Array in JavaScript
There are many ways we can initialize the Array in the JavaScript. JavaScript is a loosely types language. This means you need not worry about data type while storing them in Array. It can store any data type in a single array. Also you don’t need to provide the size of Array at the time of creation of Array. JavaScript will automatically adjust size of array according to the requirement. You can create Array by following declaration.
var array = [];
Another way of creating Array in JavaScript is
var secondArray = new Array(5);
This will create an Array of length 5.
Initializing an Array
You can initialize Array with pre defined data.
var dataArray = ['Tech', 'Pitcher', 'And', 'You'];
Related Post
Comments
One Response to “Initializing Array in JavaScript”
Leave a Reply
It is simple and descriptive. Keep it up.