Favorites

JavaScript Array.prototype.push() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Array.prototype.push()
JavaScript Array Instance methodThis method is supported by all modern browsers.
Updated 28th November 2026

The push() method adds one or more elements to the end of an array and returns the new length.

Description

The push() method adds elements to the end of an array and returns its new length. It changes the array in place.

To add all the elements of another array, spread it: a.push(...b). If you need a new array instead of changing the existing one, as in React state updates, use [...a, item] or concat().

The return value is the new length, not the array, so you can't chain push(); write arr.push(x) as its own statement. Pushing is fast because elements are added at the end and nothing else moves. Spreading very large arrays into push(), with hundreds of thousands of items, can exceed the browser's argument limit, in which case a loop or concat() is safer.

Syntax

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

Parameters

  • element1, element2, ...The elements to add to the end of the array.

Return Value

The new length of the array.

Example

const list = ['milk'];
console.log(list.push('eggs', 'bread'));
console.log(list);

const more = ['tea', 'jam'];
list.push(...more);
console.log(list);

Browser Support

The following information will show you the current browser support for the Array.prototype.push() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee