Use the concat function, like so:
var arrayA = [1, 2]; var arrayB = [3, 4]; var newArray = arrayA.concat(arrayB);
The value of newArray
will be [1, 2, 3, 4]
(arrayA
and arrayB
remain unchanged; concat
creates and returns a new array for the result).
Read full article from Javascript push array values into another array - Stack Overflow
No comments:
Post a Comment