Is there any faster/better way to "reset" the array than what Im currently doing?
-- populate arrayA and arrayCache using for loop
-- shuffle arrayA
/* empty arrayA */
arrayA = []; -
/* THIS IS THE IMPORTANT PART, reset the array (load values from arrayCache into arrayA) */
for(i = 0; i < arrayCache.length; i++)
{
arrayA.push(arrayCache[i]);
}
I populate (using loop) 2 arrays (arrayA and arrayCache), then iterate and shuffle (if condition is met) the first arrayA and then I need to reset it to its original state.
Note - if I simply do arrayA = arrayCache, then arrayCache is changed simultaneously with arrayA