Created
April 10, 2016 23:55
-
-
Save xavdid/f31a04ba502acc82cb45ce8498a2b011 to your computer and use it in GitHub Desktop.
Fat arrow scope conundrum
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
'use-strict'; | |
// using node v5.7.1 | |
var funcs = { | |
speak: function(){ | |
console.log(this.name + ' says hi'); | |
}, | |
name: 'david' | |
}; | |
var fatFuncs = { | |
speak: () => { | |
console.log(this.name + ' says hi'); | |
}, | |
name: 'david' | |
}; | |
funcs.speak(); | |
fatFuncs.speak(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment