Skip to content

Instantly share code, notes, and snippets.

@codemilli
Created February 11, 2016 16:48
Show Gist options
  • Save codemilli/dcbf6a51813beab692ff to your computer and use it in GitHub Desktop.
Save codemilli/dcbf6a51813beab692ff to your computer and use it in GitHub Desktop.
The way of replacing an object not editing with ES6
/*
* 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