Last active
November 15, 2022 11:11
-
-
Save LGitHub-sprout/77e1aef1d11f90d4299fe97e8d92aad1 to your computer and use it in GitHub Desktop.
Info on keyword this
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
// https://dmitripavlutin.com/gentle-explanation-of-this-in-javascript/ | |
// https://www.youtube.com/watch?v=zE9iro4r918 | |
// https://stackoverflow.com/questions/13441307/how-does-the-this-keyword-in-javascript-act-within-an-object-literal | |
var foo = { | |
bar: function () { | |
console.log('this.baz', this.baz, 'is typeof', typeof this.baz) | |
return this.baz; | |
}, | |
baz: 1, | |
}; | |
(function () { | |
return typeof arguments[0].bar(); | |
})(foo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment