Array.concat() Merge arrays
Last updated: 2026-09-09
Array.concat() Merge arrays
concat returns a brand-new array with the given values appended; arrays are flattened one level shallow and the original is untouched.
| Category | Arrays |
|---|---|
| ES version | ES3 (1999) |
📝 Syntax
const newArray = array.concat(value1, value2, ..., valueN);
⚙️ Parameters
| valueN | Values or arrays to append; array arguments are flattened one level. |
|---|
Returns:A new array containing the combined elements.
Mutates the original:No (returns a new value)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
[ 1, 2, 3, 4, 5 ]
[ 1, 2 ]
4
💡 Tip concat flattens only one level; use flat() or flatMap() for a full flatten.
⚠️ Warning Only the reference is copied — mutating a nested object affects both arrays.
🌐 Browser support
| Browser | |||||
|---|---|---|---|---|---|
| Array.concat() | ✓ v1 | ✓ v12 | ✓ v1.5 | ✓ v3 | ✓ v10.5 |
| Supported by all modern browsers | |||||
🏷️ Related Array Methods
💡 Related Cases
More case studies coming soon — check back later.
📚 Related Tutorials
❓ FAQ
Qconcat vs push?
Apush appends arguments as single elements in place; concat flattens array arguments one level and returns a new array.
QHow to merge multiple arrays?
AChain arr1.concat(arr2, arr3) or use the spread syntax [...arr1, ...arr2].
QDoes concat deep-copy nested objects?
ANo — it is shallow. Nested objects share references; use structuredClone for deep copies.