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

Commit 1da236e

Browse files
committed
Update styleguide for use of this references
1 parent 0c83832 commit 1da236e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,14 +1198,14 @@ If your editor/IDE isn't listed above, a list of available plugins can be found
11981198
this._firstName = 'Panda';
11991199
```
12001200

1201-
- When saving a reference to `this` use `_this`.
1201+
- When saving a reference to `this` use `self`, but prefer `bind` ([Bind on MDN] (https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind))
12021202

12031203
```javascript
12041204
// bad
12051205
function() {
1206-
var self = this;
1206+
var _this = this;
12071207
return function() {
1208-
console.log(self);
1208+
console.log(_this);
12091209
};
12101210
}
12111211

0 commit comments

Comments
 (0)