JavaScript (ES2026) reference · Array Methods
JavaScript Array concat() Method
Return a new array that joins this array with other arrays or values. The original arrays are not changed.
JavaScript (ES2026) Since ES3
Syntax
array.concat(value1, value2, /* …, */ valueN)
Parameters
| Parameter | Description |
|---|---|
values |
Arrays (their elements are added) or single values. |
Return value
A new array.
Examples
const a = [1, 2];
const b = [3, 4];
console.log(a.concat(b, 5), a);
Output
[ 1, 2, 3, 4, 5 ] [ 1, 2 ]
const a = [1, 2];
console.log([...a, ...[3, 4]]); // spread does the same
Output
[ 1, 2, 3, 4 ]
Version history
| Version | Change |
|---|---|
| JavaScript ES3 | Added |
In other languages
list.extend()· Python
Related
array.push()· Add one or more elements to the end of the array and return the new length. Changes the array in place.array.flat()· Return a new array with nested arrays flattened into it, one level deep by default or to a given depth.- JavaScript Arrays · tutorial
- JavaScript Array Methods · tutorial