Skip to content

Commit

Permalink
接上
Browse files Browse the repository at this point in the history
  • Loading branch information
dptms committed Oct 23, 2017
1 parent 9cdf068 commit c452af6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 2.arrow-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ this.hobbies.map(function (hobby) {
我们还可以利用箭头函数的便利
```
this.hobbies.map(hobby => console.log(`${this.name} loves ${hobby}`));
```
```
这是因为箭头函数没有自己的 `this` 值,他的 `this` 值是继承父级作用域的,与我们之前接触的 `this` 值是在执行时动态指定的不同,箭头函数的 `this` 值是词法作用域,也就是在定义的时候就指定的,而且以后也不会随调用方法的改变而改变。

0 comments on commit c452af6

Please sign in to comment.