Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10bece9

Browse files
authored
Use more plausible const example
1 parent f0278ef commit 10bece9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,21 @@ Make your names searchable.
9393

9494
**Bad:**
9595
```javascript
96-
// What the heck is 525600 for?
97-
for (var i = 0; i < 525600; i++) {
98-
runCronJob();
99-
}
96+
// What the heck is 86400 for?
97+
setTimeout(() => {
98+
this.blastOff()
99+
}, 86400);
100100
```
101101

102102
**Good**:
103103
```javascript
104104
// Declare them as capitalized `const` globals.
105-
const MINUTES_IN_A_YEAR = 525600;
106-
for (var i = 0; i < MINUTES_IN_A_YEAR; i++) {
107-
runCronJob();
108-
}
105+
const SECONDS_IN_DAY = 86400;
106+
107+
setTimeout(() => {
108+
this.blastOff()
109+
}, SECONDS_IN_A_DAY);
110+
109111
```
110112
**[⬆ back to top](#table-of-contents)**
111113

0 commit comments

Comments
 (0)