Array.concat(list) Last updated: 24. Jan 2023

Concat two arrays into one.

Parameters

Name Type Description
list array The other array to concat after the array function was called from.

Returns

A new array combining the two arrays.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
let array1 = [1, 2, 3];
let array2 = ["a", "b", "c"];

let both = array1.concat(array2);

write(JSON.stringify(both));

Output

The JS code above produces the output shown below:
[1,2,3,"a","b","c"]