Created
March 29, 2015 03:42
-
-
Save allanruin/a9eb3babdb919adcc7c7 to your computer and use it in GitHub Desktop.
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 gvalue = 1; | |
function myfunc1(){ | |
gvalue += 1; | |
} | |
myfunc1(); | |
console.log(gvalue);// 输出为2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment