Skip to content

Instantly share code, notes, and snippets.

@yukeehan
Created December 3, 2018 19:30
Show Gist options
  • Save yukeehan/349f86caa5bba5f808b4cfe7ccdbf781 to your computer and use it in GitHub Desktop.
Save yukeehan/349f86caa5bba5f808b4cfe7ccdbf781 to your computer and use it in GitHub Desktop.
list = {
name: 'yukee'
}
// ES5
this.state = {
list: list,
};
// ES6
this.state = {
list,
};
// ES5
var userService = {
getUserName: function (user) {
return user.firstname + ' ' + user.lastname;
},
};
// ES6
const userService = {
getUserName(user) {
return user.firstname + ' ' + user.lastname;
},
};
// ES5
var user = {
name: 'Robin',
};
// ES6
const key = 'name';
const user = {
[key]: 'Robin',
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment