34,333
edits
Changes
→Initializing the Elements of an Array
muColors[1] = "Yellow";
</pre>
Another useful way to add elements to an array is to use the ''push()'' method of the array object. The push method simply adds a new elelemt to the end of the array:
<pre>
var myColors = new Array();
myColors.push ("Red");
myColors.push ("Green");
myColors.push ("Indigo");
myColors.push ("Violet");
</pre>