Javascript: Arrays 2

To change or add an element to an array we do the following.


var myarray = ["door","belt"];
alert(myarray[0]);
//change the zeroth element
myarray[0] = "shoe";
alert(myarray[0]);
//add a item to the end
myarray.push("awesome");
//now our array is ["shoe","belt","awesome"]