tbom

13 years agoContributor

Solved

# merge 2 arrays into 1

is it possible to easily merge 2 arrays into one?

consider the following (jscript)

var x = {};

x[1] = "One";

x[2] = "Two";

var y = {};

y[3] = "Three";

y[4] = "Four";

and then something like :

z = x <join> y;

z should now contain :

z[1] = "One";

z[2] = "Two";

z[3] = "Three";

z[4] = "Four";

Is it at all possible?

consider the following (jscript)

var x = {};

x[1] = "One";

x[2] = "Two";

var y = {};

y[3] = "Three";

y[4] = "Four";

and then something like :

z = x <join> y;

z should now contain :

z[1] = "One";

z[2] = "Two";

z[3] = "Three";

z[4] = "Four";

Is it at all possible?

- but you are defining literal objects, not arrays.

x and y should both be [] not {}