Created
July 11, 2021 17:08
-
-
Save tklee1975/6be2eec0e66b707e3f85444d06dde23d to your computer and use it in GitHub Desktop.
JS: This vs No-this
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
function foo() { | |
var a = 2; | |
function bar() { | |
console.log(a); | |
} | |
bar(); | |
} | |
foo() |
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
function foo() { | |
var a = 2; | |
function bar() { | |
console.log(this.a); | |
} | |
this.bar(); | |
} | |
foo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment