Javascript push array method

Push

Adds one or more elements to the end of an array and returns the new length of the array.

Syntax

array.push(element1, …, elementN)

Example

The following code creates the sports array containing two elements, then appends two elements to it. After the code executes, sports contains 4 elements: “soccer”, “baseball”, “football” and “swimming”.

var sports = ["soccer", "baseball"];
sports.push("football", "swimming");
DOWNLOAD SOLUTION HERE