Last active
October 21, 2018 18:09
-
-
Save zeakd/5532819a254e1a57f7131b33304e8d6c to your computer and use it in GitHub Desktop.
Examples to explain the shape of arrow function
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
// function | |
const kim = { | |
name: 'Kim', | |
hello: function() { | |
console.log(`hi, ${this.name}`) | |
} | |
} | |
// arrow function | |
const lee = { | |
name: 'Lee', | |
hello: () => { | |
console.log(`hi, ${this.name}`) | |
} | |
} | |
kim.hello(); | |
lee.hello(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment