Using Arrays (integer, index, associative array)
3. The push() Method
The push() method enables you to add
one or more items to an array. This method may contain several parameters where
each of these parameters represents an item which will be added to the end of
the array.
For
example,
var myArray = ["Kate", "Sun"];
myArray.push("Juliet"); //Adds "Juliet" at the end of the array
myArray.push("Libby", "Shannon"); //Adds "Libby" and "Shannon" at the end of the array
console.log(myArray);
When we try to print the array in the example above using console.log, it will print ["Kate", "Sun", "Juliet", "Libby", "Shannon"].