JavaScript Array push() method
adds new elements to the end of an array

push() method adds new elements to the end of an array.

push() method returns the new length of the array.

syntax

push(element1, element2, /* …, */ elementN)

element1, …, elementN The element(s) to add to the end of the array.

push() method changes the original array.

push() method changes the length of the array.

syntax 1 description
add new element to the end of myArray
myArray.push(element1)
syntax 2 description
add new elements (more than 1) to the end of myArray
myArray.push(element1, element2, ..., elementN)