It seems that javascript considers array as a pointer, therefore, simple assignment like:

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;

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.