Created
July 26, 2016 07:09
-
-
Save savelee/9e26fc84b5316c1fdbb607e897c1ac4a to your computer and use it in GitHub Desktop.
Enhanced Object literals
This file contains 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
//ES2015 | |
function getVideoGame(title, version, platform) { | |
return { | |
title, | |
version, | |
platform | |
}; | |
} | |
getVideoGame("Uncharted", "4", "PS4") | |
/* returns: | |
{ | |
title : "Uncharted", | |
version: "4", | |
platform: "PS4" | |
} | |
*/ |
This file contains 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
//ES5 | |
function getVideoGame(t, v, p) { | |
return { | |
title : t, | |
version: v, | |
platform: p | |
}; | |
} | |
getVideoGame("Uncharted", "4", "PS4") | |
/* returns: | |
{ | |
title : "Uncharted", | |
version: "4", | |
platform: "PS4" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment