Skip to content

Instantly share code, notes, and snippets.

@emilong
Created October 13, 2016 20:47
Show Gist options
  • Save emilong/8be2404ad24ee41032af104f1aa7c708 to your computer and use it in GitHub Desktop.
Save emilong/8be2404ad24ee41032af104f1aa7c708 to your computer and use it in GitHub Desktop.
const original = [0,1,2,3];
const copy = Object.assign([], original, { 2: 42 }); // [0,1,42,3]
console.log(original);
// [ 0, 1, 2, 3 ]
console.log(copy);
// [ 0, 1, 42, 3 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment