How To: JavaScript - Combine Arrays
The most common way to combine JavaScript arrays is to use the concat() method. The result of the concat() method is a new array with the values of the "source" arrays.
Syntax:
var result = array1.concat(array2, array3, ..., arrayX);
Example:
var firstArray = ["value1", "value2", "value3"]; var secondArray = ["value4", "value5"]; var result = firstArray.concat(secondArray); result === ["value1", "value2", "value3", "value4", "value5"];