function A(){ let x = [1,2] let y = x.slice(); B(x) alert('x=' + x); return y; } function B(x){ x.push(3); } var y = A(); alert('y=' + y);