Created
June 25, 2015 07:59
-
-
Save porfirion/0ff08b6eba4e46c780a7 to your computer and use it in GitHub Desktop.
Wrong closure
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 test = (function() { | |
_this = 'test'; | |
return function() { | |
console.log(_this); | |
}; | |
})(); | |
(function() { | |
_this = 'another'; | |
test(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is wrong closure:
_this
is interpreted as global variable, because there is novar
before_this
declaration