var x = [1, 2]; var y = x.slice(0); y[0] = 100; //y --> [100, 2] alert(x[0]); //1
The new copy evolve independently of the old copy.
No comments:
Post a Comment