concat()

ES3+

Merges two or more arrays into a new array.

Syntax

array.concat(value1, value2, ...)

Parameters

values Array | any

Arrays or values to concatenate

Return Value

Array

A new array instance

Examples

JavaScript
const a = [1, 2];
const b = [3, 4];
const c = a.concat(b);
console.log(c);
Output:
// [1, 2, 3, 4]

Related Methods