The push() method adds one or more elements to the end of an array and returns the new length. This tutorial covers syntax, five examples, spread merging, stack patterns with pop(), and why you cannot chain .push() on its return value.
01
Syntax
arr.push(...)
02
Add end
Append items
03
Returns
New length
04
Multiple
Many args OK
05
Stack
LIFO + pop
06
ES3
Universal
Fundamentals
Introduction
Need to grow a list at runtime—collect user choices, queue tasks, or build a shopping cart? push() appends values to the back of an array in one call. It is one of the most common array operations in JavaScript.
Like pop(), push()mutates the original array. If you need a new array without changing the source, use spread or concat() instead.
Concept
Understanding the push() Method
array.push(element1, element2, ...) inserts each argument at index length, then length + n, and so on. The return value is the updated length—a number, not the array.
You can pass as many arguments as you need in a single call. To merge another array’s items, spread them: arr.push(...otherArray).
💡
Beginner Tip
fruits.push("a", "b").push("c") does not work—the first push returns a number, and numbers have no push method. Call push on the array variable each time.
concat result: [1, 2, 3, 4]
base unchanged: [1, 2]
after push: [1, 2, 3, 4]
How It Works
concat leaves the original alone. push updates it—important in React/state patterns where you often prefer [...arr, item].
Applications
🚀 Common Use Cases
Dynamic lists — collect user input or API results.
Stack operations — pair with pop() for LIFO.
Batch append — multiple arguments in one call.
Merge in place — target.push(...source).
Build queues from the end — when order allows.
Track size — use return value as new length.
🧠 How push() Runs
1
Read arguments
Engine collects all values passed to push.
Input
2
Write at end
Each value stored starting at current length.
Append
3
Update length
Array grows by the number of arguments.
Mutate
4
🔢
Return new length
Caller gets a number, not the array reference.
Important
📝 Notes
Mutates the array—length increases.
Returns new length, not the array (no chaining).
Accepts any number of arguments in one call.
Use spread to flatten array arguments: push(...arr).
O(1) amortized for end insertion; faster than unshift at scale.
For immutable updates, prefer [...arr, x] or concat.
ES3—supported everywhere JavaScript runs.
Compatibility
Browser & Runtime Support
Array.prototype.push() is one of the oldest array methods, available since JavaScript 1.2 / ES3.
✓ Baseline · ES3
Array.prototype.push()
Supported in every browser ever shipped with JavaScript arrays, including Internet Explorer 3+, and all Node.js versions.
100%Universal support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
Array.push()Universal
Bottom line: Safe to use in any environment. No polyfill ever needed.
Wrap Up
Conclusion
push() appends one or more elements to the end and returns the new length. Use it for dynamic growth and stack patterns with pop(); choose concat or spread when you must keep the original array unchanged.
Next, learn reduce() to fold an array into a single value.
Pass multiple items in one push(a, b, c) call when handy
Use push(...arr) to merge arrays in place
Pair with pop for stack behavior
Use spread or concat when immutability is required
Store return value when you need the updated length
❌ Don’t
Chain .push() on the return value (it is a number)
Push an array without spread when you mean merge items
Forget mutation affects all references to the array
Use unshift when end insertion is enough
Assume push returns the updated array
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Array.push()
Append to the end and get the new length back.
5
Core concepts
📝01
Syntax
arr.push(...)
API
🔢02
Returns
New length.
Number
⚠03
Mutates
In place.
Side effect
🗃04
Stack
With pop.
Pattern
…05
Spread
Merge arrays.
Trick
❓ Frequently Asked Questions
push() adds one or more elements to the end of an array, increases length, and returns the new length.
Yes. push() changes the array in place by appending elements at the end.
The new length of the array (a number), not the array itself. You cannot chain .push() on the return value.
push() adds to the end; pop() removes from the end. Together they implement a LIFO stack.
push() adds at the end (fast). unshift() adds at the start (slower on large arrays because other elements shift).
push() has been available since JavaScript 1.2 / ES3. It works in every browser including very old environments.
Did you know?
Modern code often writes [...arr, newItem] instead of arr.push(newItem) when updating React or Redux state, because spread creates a new array reference without mutating the old one.