I want to create an array called currentArray, but I want its contents to be made up from a different array. Basically a copy. However, I want to affect which array is being copied into currentArray with a variable (int).
Here's what I mean:
function region(number)
{
var regionArray1 = [1093, 1276, 436, 541];
var regionArray2 = [563, 747, 310, 423, 744, 947, 601, 715];
var currentArray = (regionArray+number)[];
}
number will be either 1 or 2. What is the correct way to do this, if I can? I've also tried var currentArray = ("regionArray"+number)[]; but that doesn't seem to be the right way either.