Simple: it's the same array.
var A = [20, 30, 25, 5, 3, 2];
var B = A;
Creates
A
and "points" it at an array of values, then creates
B
and copies the "pointer" from
A
to
B
, so they both refer to the same locations in memory. Hence, any change to the data via
A
will also change the data if you access it via
B
To get a copy of the array data, use the
slice[
^] function:
var A = [20, 30, 25, 5, 3, 2];
var B = A.slice();