JavaScript Array push() Method

The JavaScript array push() method adds one or more elements to the end of the given array. This method changes the length of the original array.

Javascript array push() method appends the given element(s) in the last of the array and returns the length of the new array.


array.push(item1, item2, ..., itemX)

Parameters This method contains as many numbers of parameters as the number of elements to be inserted into the array.

Return value: This method returns the new length of the array after inserting the arguments into the array.


var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi", "Lemon", "Pineapple");

Example -