Skip to content

Instantly share code, notes, and snippets.

@rodrigograca31
Last active October 14, 2019 15:01
Show Gist options
  • Save rodrigograca31/e2ec48b4877c31a787b8a5b177b20a4b to your computer and use it in GitHub Desktop.
Save rodrigograca31/e2ec48b4877c31a787b8a5b177b20a4b to your computer and use it in GitHub Desktop.
const person = {
name: 'Rodrigo',
age: 99,
how_old: function() { return this.name + ' is ' + this.age + ' old'}
}
person.how_old()
// Why dont arrow functions work with this?
// How do you solve it?
const person2 = {
name: 'Rodrigo',
age: 99,
how_old: () => this.age + ' is ' + this.age + ' old'
}
person2.how_old()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment