Created
June 4, 2020 06:47
-
-
Save mannharleen/87ee0fafb8f4926b1318c88c5a8e3dff to your computer and use it in GitHub Desktop.
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
const myObject = { | |
myArrowFunction: null, | |
myMethod: function () { | |
this.myArrowFunction = () => { console.log(this) }; | |
} | |
}; | |
myObject.myMethod() // this === myObject | |
myObject.myArrowFunction() // this === myObject | |
const myArrowFunction = myObject.myArrowFunction; | |
myArrowFunction() // this === myObject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment