Skip to content

Instantly share code, notes, and snippets.

@scastiel
Created October 15, 2016 09:47
Show Gist options
  • Save scastiel/cd18abb17acce58f00768969af1170c4 to your computer and use it in GitHub Desktop.
Save scastiel/cd18abb17acce58f00768969af1170c4 to your computer and use it in GitHub Desktop.
const objA = {
a: 1,
b: 2
}
const objB = {
... objA
b: 3,
c: 4
}
// Is equivalent to:
const objB = Object.assign({}, objA, { b: 3, c: 4 });
console.log(objA, objB);
// { a: 1, b: 2 } { a: 1, b: 3, c: 4 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment