Merge 2 or More Array in Javascript

Here is code snippet to merge 2 or more array in javascript.

var arr1 = ["A", "B", "Z"];
var arr2 = ["X"];
var arr3 = [10];

var mergedArray = arr1.concat(arr2).concat(arr3);
console.log(mergedArray); // ["A", "B", "C", "X", 10]

Reference: http://stackoverflow.com/a/1584377/1936697

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s