arr.push(element0, element1, … , elementN)
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.
Below is an example of the Array push() method.
Example 2: In this example, the function push() adds the numbers to the end of the array.
Example 3: In this example, the function push() adds the objects to the end of the array.
- Google Chrome 1.0 and above
- Microsoft Edge 12 and above
- Mozilla Firefox 1.0 and above
- Safari 1 and above
- Opera 4 and above