Skip to content

Instantly share code, notes, and snippets.

@luisafvaca
Last active May 15, 2020 15:21
Show Gist options
  • Save luisafvaca/e21b6e77090791cc15ccc410b2e4e6d2 to your computer and use it in GitHub Desktop.
Save luisafvaca/e21b6e77090791cc15ccc410b2e4e6d2 to your computer and use it in GitHub Desktop.
Arrow function VS Anonymous function
//Considering this code.
var person = πŸ‘©πŸ»β€πŸ¦°;
var myObjectLiteral = {
person: "πŸ‘©πŸ»β€πŸ¦³",
sayHi: function(){ console.log(`Hi ${this.person}`)}
} // Hi "πŸ‘©πŸ»β€πŸ¦³
var myObjectLiteral = {
person: "πŸ‘©πŸ»β€πŸ¦³",
sayHi: () => { console.log(`Hi ${this.person}`)}
} // Hi πŸ‘©πŸ»β€πŸ¦°
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment