We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
闭包 = 函数 + 函数能够访问的自由变量 自由变量是指在函数中使用的,但既不是函数参数也不是函数的局部变量的变量。
var a = 1; function foo() { console.log(a); } foo();
foo 函数可以访问变量 a,但是 a 既不是 foo 函数的局部变量,也不是 foo 函数的参数,所以 a 就是自由变量, 那么,函数 foo + foo 函数访问的自由变量 a 不就是构成了一个闭包。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
闭包 = 函数 + 函数能够访问的自由变量
自由变量是指在函数中使用的,但既不是函数参数也不是函数的局部变量的变量。
foo 函数可以访问变量 a,但是 a 既不是 foo 函数的局部变量,也不是 foo 函数的参数,所以 a 就是自由变量, 那么,函数 foo + foo 函数访问的自由变量 a 不就是构成了一个闭包。
The text was updated successfully, but these errors were encountered: