Array.prototype.push

Appends new elements to the end of an array, and returns the new length of the array.

Syntax

push(...items)

Return value

The new length of the array.

Parameters

Example

var drinks = ["coffee", "tea"]
drinks.push("water")
drinks
["coffee", "tea", "water"]

See also