Advertisement
juliarnasution

mutable array

Sep 3rd, 2019
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let array1 = [1,2,3];
  2. let array2 = array1;
  3. console.log(array2); //[ 1, 2, 3 ]
  4. array2.push(4,5,6);
  5. console.log(array2); //[ 1, 2, 3, 4, 5, 6 ]
  6. console.log(array1); //[ 1, 2, 3, 4, 5, 6 ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement