Arrays can be created with the Array() constructor function. Once you create the array, any number of indexed elements can be easily assigned to the array:
var array1 = new Array();
array1[0] = "JavaScript is cool!";
array1[1] = 10.5;
array1[2] = false;
array1[3] = { x:10, y:5 };
array1[0] = "JavaScript is cool!";
array1[1] = 10.5;
array1[2] = false;
array1[3] = { x:10, y:5 };
Arrays can also be initialized by passing array elements to the Array() constructor function:
var array1 = new Array("JavaScript is cool!", 10.5, false, { x:10, y:5 });