Last active
October 1, 2018 13:44
-
-
Save yesvods/4c7251f060029c8a5b07 to your computer and use it in GitHub Desktop.
Merge Object with ES7 object spread
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj1 = {name:"xiaoming", age: 23} | |
const obj2 = {age: 33} | |
const obj3 = {...obj1, ...obj2} | |
//obj3 ==> {"name":"xiaoming","age":33} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this @yesvods. This stopped me from having to use lodash to merge some objects!