Javascript push() method appends elements in the Array. The push() method adds new elements to the end of an array and returns the new length. The push() method appends new item(s) at the end of the Array.

Javascript Append to Array

To append any item in Javascript array, use one of the following methods.

  1. Use the Array  .prototype.push function to append values to the end of the array.
  2. If you want to add the elements of one array to another array, you can use the Array .concat() method.
  3. If you need to append any value to the start of the array, that means insert at the first index, then you can use the Array  .prototype.unshift method.

Javascript array push()

Javascript array push() is an inbuilt method that adds an element at the end of an array. You can append single or multiple items in the Array using the push() method.

Syntax

array.push(element1, element2,..., elementn)

#javascript

Javascript Append to Array: How to Append Item in JS Array
1.60 GEEK