JavaScript-Algorithms
JavaScript-Algorithms copied to clipboard
基础题,直接写出答案
let x = [1, 2, 3];
let y = x;
let z = [4, 5, 6];
y[0] = 10;
y = z;
z[1] = 20;
x[2] = z = 30;
console.log(x, y, z);
[10,2,30] [4,20,6] 30
x-->[1,2,3]
y=x 即
y-->[1,2,3]
z-->[4,5,6]
y[0]=10
即[10,2,3]
y-->[4,5,6]
z[1] = 20
[4,20,6]
z=30
x[2]=z
[10,2,30]