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

ParameterDescription
values Arrays (their elements are added) or single values.

Return value

A new array.

Examples

Join arraysTry it yourself
const a = [1, 2];
const b = [3, 4];
console.log(a.concat(b, 5), a);

Output

[ 1, 2, 3, 4, 5 ] [ 1, 2 ]
The spread alternativeTry it yourself
const a = [1, 2];
console.log([...a, ...[3, 4]]); // spread does the same

Output

[ 1, 2, 3, 4 ]

Version history

VersionChange
JavaScript ES3Added

In other languages