Created
February 11, 2016 16:48
-
-
Save codemilli/dcbf6a51813beab692ff to your computer and use it in GitHub Desktop.
The way of replacing an object not editing with ES6
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
/* | |
* Declare Object | |
*/ | |
let profile = { | |
name: 'yunmi', | |
age: '26', | |
nickname: 'pinky' | |
}; | |
/* | |
* Change Object | |
*/ | |
profile.name = 'yunmi kim'; | |
/* | |
* Replace Object | |
*/ | |
profile = { | |
...profile, | |
name: 'yunmi kim' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment