Skip to content

Instantly share code, notes, and snippets.

@yesvods
Last active October 1, 2018 13:44
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save yesvods/4c7251f060029c8a5b07 to your computer and use it in GitHub Desktop.
Save yesvods/4c7251f060029c8a5b07 to your computer and use it in GitHub Desktop.
Merge Object with ES7 object spread
const obj1 = {name:"xiaoming", age: 23}
const obj2 = {age: 33}
const obj3 = {...obj1, ...obj2}
//obj3 ==> {"name":"xiaoming","age":33}
@Andy-set-studio
Copy link

Thanks for this @yesvods. This stopped me from having to use lodash to merge some objects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment