Created
March 4, 2015 03:18
-
-
Save ruanyf/cae49b92b0bd43c4d57d to your computer and use it in GitHub Desktop.
JavaScript作用域
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
function a(x,y){ | |
y = function() { x = 2; }; | |
return function(){ | |
var x = 3; | |
y(); | |
console.log(x); | |
}.apply(this, arguments); | |
} | |
a(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
是3啊。不是很符合直觉吗?