When a closure "captures" a variable it "lifts" the variable out of its local scope and effectively moves it into an anonymous object.
当一个闭包“捕获”一个变量时,它就会将这个变量提取出它的本地范围,移到一个匿名对象里。
Watch the variables being used in a function. If you notice a function using an out-of-scope variable more than once, store it in a local variable and use that instead.
仔细检查函数中所有使用的变量,如果有一个变量不是当前作用域定义的,而且使用了不止一次,那么我们就应该把这个变量保存在局部变量中,而使用这个局部变量来进行读写操作。
The calculator makes use of the local statement to declare x as a local variable that is available only within the scope of the mycalc function.
这个计算器利用local语句将x声明为局部变量,只能在mycalc函数的范围内使用。
A local variable is one that is only available for use (that is, you can assign to it, or fetch its value) within the scope in which it is declared, and within nested scopes as well.
本地变量是仅可以在声明它的范围中和嵌套范围中使用的变量(也就是说,您可以向其赋值,也可以从中取值)。
Because tally is a local variable within the function, it is created anew with each call and falls out of scope and is destroyed automatically when each call returns.
由于tally是函数内的本地变量,它将在每次调用时重新创建并清空范围,并且在每个调用被返回时自动销毁。
Firefox 3.1 Beta 2 was somewhat surprising as local variable writes were very fast but performance degraded significantly once the variable was out of the local scope.
Firefox 3.1Beta2的表现有点出人意料,对于局部变量执行的效率非常高,但随着作用域层数的增加,效率便大打折扣。
A local variable is a variable that has its scope set to be visible in "This test only."
本地变量就是一个范围设置为“Thistest only”可见的变量。
Local variables are faster to access than out-of-scope variables because they exist in the first variable object of the scope chain.
局部变量比域外变量快,因为它位于作用域链的第一个对象中。
Sets the name and lexical scope of this local variable.
设置该局部变量的名称和词法范围。
If this is a local variable within a scope, the end offset will fall within the offsets defined for the scope.
如果此变量为某个范围内的局部变量,则结束偏移量将位于为此范围定义的偏移量界线内。
Use this function to clear variables of type VARIANTARG (or VARIANT) before the memory that contains the VARIANTARG is freed (as when a local variable goes out of scope).
使用这个函数去清除VARIANTARG(或VARIANT)类型的变量在内存包含的VARIANTARG被释放(当一个局部变量超出作用域时)。
Use this function to clear variables of type VARIANTARG (or VARIANT) before the memory that contains the VARIANTARG is freed (as when a local variable goes out of scope).
使用这个函数去清除VARIANTARG(或VARIANT)类型的变量在内存包含的VARIANTARG被释放(当一个局部变量超出作用域时)。
应用推荐