How to create arrays in JavaScript?
Arrays are created by using new Array() in Java Script.
For example var employees = new Array();
The elements to this array is assigned as follows –
employees[0] = "Kumar"
employees[1] = "Fedrick"
How to create arrays in JavaScript?
Although you can create the arrays using ‘new’ (var myArray = new myArray[10];), it is recommended that you create it in the following way: var myArray = [];
You don't need to tell Javascript how many items to size the Array for. Javascript automatically increases the size of the Array as needed.