Created
July 27, 2018 23:11
-
-
Save kristyburge/1408f8119e90883a5fa96fa587a9e844 to your computer and use it in GitHub Desktop.
Arrow functions example
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
var objReg = { | |
hello: function() { | |
return this; | |
} | |
}; | |
var objArrow = { | |
hello: () => this | |
}; | |
objReg.hello(); // returns the objReg object that we expect | |
objArrow.hello(); // returns the Window object! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment