Created
March 20, 2017 19:35
-
-
Save topicus/952347c12e6c9c60f7a01018302f931c to your computer and use it in GitHub Desktop.
Where this points in object methods
This file contains hidden or 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
// From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this | |
let o = { | |
prop: 37, | |
f: function() { | |
return this.prop; | |
} | |
}; | |
console.log(o.f()); // logs 37 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment