Created
December 3, 2018 19:30
-
-
Save yukeehan/349f86caa5bba5f808b4cfe7ccdbf781 to your computer and use it in GitHub Desktop.
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
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