a = b
will not copy values, variable a will just "point out" to variable b.
Consider following example:
var a = ; var b = ; a = [1, 2, 3, 4] b = a; b.splice(3);
In this case, variable a will be 1, 2, 3
Full example you can see here.
Solution is something like:
b = .concat(a);
Taken from here.