Array.push() Append items

Last updated: 2026-09-09

Array.push() Append items

push appends one or more elements to the end and returns the new length. Together with pop it forms a stack (LIFO).

CategoryArrays
ES versionES1 (1997)

📝 Syntax

const newLength = array.push(element1, ..., elementN);

⚙️ Parameters

elementNOne or more elements appended in order.

Returns:The new length (number).

Mutates the original:Yes (in place)

▶ Example

Edit the code, press Run, and see the result in the output panel:

Output:

3
[ 'task1', 'task2', 'task3' ]
4
💡 Tip push(arr2) appends the array as one element — spread it: arr1.push(...arr2).
ℹ️ info push returns the length, not the array — it cannot be chained.

🌐 Browser support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
Array.push() v1 v12 v1 v1 v1
Supported by all modern browsers
More case studies coming soon — check back later.

📚 Related Tutorials

❓ FAQ

QCan push add multiple elements at once?
AYes — push(1, 2, 3) appends in order. To append another array's items use push(...arr2).
QDoes push return the array or the length?
AThe new length (a number) — a legacy design, so push cannot be chained.
Qpush or concat?
Apush mutates (faster); concat or spread when the original must stay intact.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏