Skip to content

Commit 84f8ea6

Browse files
mitoghryanmcdermott
authored andcommitted
Simplify "Use searchable names" example (ryanmcdermott#121)
* Simplify "Use searchable names" example There is no need to create an arrow function to execute a function inside of the timeout. * Remove `this` to avoid context problems
1 parent aa069b3 commit 84f8ea6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ can help identify unnamed constants.
8080
**Bad:**
8181
```javascript
8282
// What the heck is 86400000 for?
83-
setTimeout(() => {
84-
this.blastOff();
85-
}, 86400000);
83+
setTimeout(blastOff, 86400000);
8684

8785
```
8886

@@ -91,9 +89,7 @@ setTimeout(() => {
9189
// Declare them as capitalized `const` globals.
9290
const MILLISECONDS_IN_A_DAY = 86400000;
9391

94-
setTimeout(() => {
95-
this.blastOff();
96-
}, MILLISECONDS_IN_A_DAY);
92+
setTimeout(blastOff, MILLISECONDS_IN_A_DAY);
9793

9894
```
9995
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)