There are two ways to create array in JavaScript like other languages:
a) The first way to create array
Declare Array:
Code
Collapse | Copy Code
var names = new Array();
Add Elements in Array:-
names[0] = "Vikas";
names[1] = "Ashish";
names[2] = "Nikhil";
a) The first way to create array
Declare Array:
Code
Collapse | Copy Code
var names = new Array();
Add Elements in Array:-
names[0] = "Vikas";
names[1] = "Ashish";
names[2] = "Nikhil";