Skip to content

Instantly share code, notes, and snippets.

@MartinsAlexandre
Last active March 11, 2018 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinsAlexandre/3218e1a0df2dfcd8dab9b08f97479287 to your computer and use it in GitHub Desktop.
Save MartinsAlexandre/3218e1a0df2dfcd8dab9b08f97479287 to your computer and use it in GitHub Desktop.
<script>
const profile = {
name: 'Alex',
getName() {
return this.name;
}
};
console.log(profile.getName());
</script>
//ou
<script>
const profile = {
name: 'Alex',
getName: function () {
return () => this.name;
}
};
console.log(profile.getName());
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment