Created
September 22, 2010 21:57
-
-
Save paulbaumgart/592659 to your computer and use it in GitHub Desktop.
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
| var my_eval = eval; | |
| (function() { | |
| var x = 5, | |
| y = 5; | |
| eval("var x = 6"); | |
| my_eval("var y = 6"); | |
| console.log(x); // 6 | |
| console.log(y); // 5 | |
| })(); | |
| console.log(y); // 6 | |
| //console.log(x); // error |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, looks like calling any alias to the eval function makes any variables created by eval go into the global scope.