It depends on weather you want to add the items from
Arr1
,
Arr2
and
Arr3
or add the actuall arrays.
For example, this solution adds the items;
function add(source, target) {
for(var i = 0; i < source.length; ++i)
target.push(source[i]);
}
var Arr_all = [];
var Arr1 = [1, 2, 3];
var Arr2 = [4, 5, 6];
var Arr3 = [7, 8, 9];
add(Arr1, Arr_all);
add(Arr2, Arr_all);
add(Arr3, Arr_all);
This leaves the content of
Arr_all
as;
[1, 2, 3, 4, 5, 6, 7, 8, 9]
But if you want to add the actual arrays you'd do;
var Arr1 = [1, 2, 3];
var Arr2 = [4, 5, 6];
var Arr3 = [7, 8, 9];
var Arr_all = [Arr1, Arr2, Arr3];
That leaves the content of Mcode>Arr_all as;
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
Hope this helps,
Fredrik