如果一个本地变量或参数的作用域包括了匿名方法,则该变量或参数称为匿名方法的外部变量(outer variables)。在multiplyallby方法中,a和factor就是传递给apply方法的匿名方法的外部变量。
基于8个网页-相关网页
A nested, or inner, function can inherit the arguments and variables of its outer function, and is private to that function.
一个嵌套的内部函数可以继承外部函数的参数和变量,并由该外部函数私有。
Closures are powerful because they enable inner functions to retain access to an outer function's variables even after the outer function has returned.
闭包功能非常强大,原因是它们使内部函数在外部函数返回时也仍然可以保留对此外部函数的变量的访问。
When an inner function gains and USES access to its outer function's variables it is known as a closure.
当内部函数获得和使用其外部函数的变量时,就称其为一个闭包。
应用推荐