Skip to content
This repository was archived by the owner on Sep 12, 2022. It is now read-only.

Commit 611fe86

Browse files
committed
Updated example as it was incorrect
1 parent c9728cd commit 611fe86

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,11 +1237,18 @@ If your editor/IDE isn't listed above, a list of available plugins can be found
12371237
12381238
// good
12391239
function() {
1240-
var _this = this;
1240+
var self = this;
12411241
return function() {
1242-
console.log(_this);
1242+
console.log(self);
12431243
};
12441244
}
1245+
1246+
// better
1247+
function () {
1248+
return function() {}
1249+
console.log(this);
1250+
}.bind(this);
1251+
}
12451252
```
12461253

12471254
- Name your functions. This is helpful for stack traces.

0 commit comments

Comments
 (0)