JavaScript Array concat() Method

you will learn how to use the JavaScript Array concat() method to merge two or more arrays into a single array.

The JavaScript array concat() method combines two or more arrays and returns a new string. This method doesn't make any change in the original array.

The concat() method is used to join two or more arrays.

This method does not change the existing arrays, but returns a new array, containing the values of the joined arrays.


array1.concat(array2, array3, ..., arrayX)


Join three arrays:

var hege = ["Cecilie", "Lone"];
var stale = ["Emil", "Tobias", "Linus"];
var kai = ["Robin"];
var children = hege.concat(stale, kai);

Example -