Here is a simple bit of code that you can use to merge one or more arrays. The function you need is called contact().
Take the following two arrays, both of which contain numbers.
- var array1 = new Array(1,2,3,4);
- var array2 = new Array(5,6,7,8);
To join these two arrays together we use the concat() function like this.
array1 = array1.concat(array2);
The variable array1 now contains the contents of both arrays.