diff --git a/201711/this.md b/201711/this.md index ed39816..027bb6f 100644 --- a/201711/this.md +++ b/201711/this.md @@ -108,7 +108,7 @@ foo.prototype.sayA = function () { console.log(this.a) } var bar = new foo(2) -foo.sayA() // 2 +bar.sayA() // 2 ``` 而尖头函数十分特别,你可以把它理解为 bind 函数的语法糖,它的 this 同外层函数的 this。 @@ -132,4 +132,4 @@ this 是 JavaScript 的一大难点,多年经验的前端程序员都可能对 ------ -作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。 \ No newline at end of file +作者:肖沐宸,[github](https://github.com/cheogo/learn-javascript)。