Skip to content

Instantly share code, notes, and snippets.

@justanotherdot
Created September 1, 2017 01:16
Show Gist options
  • Save justanotherdot/de917b62479ba8acaa880fce0aa479be to your computer and use it in GitHub Desktop.
Save justanotherdot/de917b62479ba8acaa880fce0aa479be to your computer and use it in GitHub Desktop.
Object.assign is shallow
'use strict';
var obj0 = {
a: {
b: 12
}
};
var obj1 = Object.assign({}, obj0); // Similar to object spread.
obj1.a.b += 12;
console.log('obj0', obj0.a);
console.log('obj1', obj1.a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment