function foo(x) { x.push(4); document.writeln(x + '</br>'); x = [5, 6, 7]; document.writeln(x + '</br>'); } var a = [1, 2, 3]; foo(a); document.writeln(a);