mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2024-04-21 12:32:22 +00:00
edit let
This commit is contained in:
+1
-1
@@ -158,7 +158,7 @@ bar();
|
||||
上面代码中,函数bar的参数func,默认是一个匿名函数,返回值为变量foo。这个匿名函数的作用域就不是bar。这个匿名函数声明时,是处在外层作用域,所以内部的foo指向函数体外的声明,输出outer。它实际上等同于下面的代码。
|
||||
|
||||
|
||||
```js
|
||||
```javascript
|
||||
let foo = 'outer';
|
||||
let f = x => foo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user