Skip to content

Instantly share code, notes, and snippets.

@abhinavsingi
Created June 10, 2018 07:07
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 abhinavsingi/a2a97133695f333f91b920d6de066b81 to your computer and use it in GitHub Desktop.
Save abhinavsingi/a2a97133695f333f91b920d6de066b81 to your computer and use it in GitHub Desktop.
Usage of Object.assign
const obj = {};
for(i=0;i<100000;i++){
obj[i] = 'some long string which will need to be copied';
}
const obj2 = {key: 'This is final object'};
const final = Object.assign({}, obj2, obj);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment