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).
| Category | Arrays |
|---|---|
| ES version | ES1 (1997) |
📝 Syntax
const newLength = array.push(element1, ..., elementN);
⚙️ Parameters
| elementN | One 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 | |||||
|---|---|---|---|---|---|
| Array.push() | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported by all modern browsers | |||||
🏷️ Related Array Methods
💡 Related Cases
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.