Array methods

Array.prototype.push()

Try the free JavaScript compiler

Appends values in argument order and mutates the receiver. Returns the resulting length, not the array.

Formal Syntax & Structure

javascript syntaxjavascript
array.push(...items)

Parameters & Attributes

NameTypeDescription
itemsanyZero or more appended values.

Return Value

Number

New length.

Working Example

Example Snippetjavascript
const a=[2];console.log(a.push(4,6),a.join(","));
JavaScript Reference