Skip to content

Instantly share code, notes, and snippets.

@vipulbhj
Created December 4, 2019 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vipulbhj/93406869984293cc80f10b62d38e292a to your computer and use it in GitHub Desktop.
Save vipulbhj/93406869984293cc80f10b62d38e292a to your computer and use it in GitHub Desktop.
let arr1 = [1, 2, 4, 5];
let arr2 = array1;
arr1 = [];
console.log(arr2);
// -> Output [1, 2, 4, 5];
let arr1 = [1, 2, 4, 5];
let arr2 = array1;
arr1.length = 0;
console.log(arr2);
// -> Output [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment