Skip to content

Commit 50e5c1b

Browse files
Merge pull request ryanmcdermott#33 from wordofchristian/patch-1
Use const instead of var
2 parents cea298d + ce9f41f commit 50e5c1b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

+11-8
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,22 @@ can help identify unnamed constants.
7979

8080
**Bad:**
8181
```javascript
82-
// What the heck is 525600 for?
83-
for (let i = 0; i < 525600; i++) {
84-
runCronJob();
85-
}
82+
// What the heck is 86400 for?
83+
setTimeout(() => {
84+
this.blastOff()
85+
}, 86400);
86+
8687
```
8788

8889
**Good**:
8990
```javascript
9091
// Declare them as capitalized `const` globals.
91-
const MINUTES_IN_A_YEAR = 525600;
92-
for (let i = 0; i < MINUTES_IN_A_YEAR; i++) {
93-
runCronJob();
94-
}
92+
const SECONDS_IN_DAY = 86400;
93+
94+
setTimeout(() => {
95+
this.blastOff()
96+
}, SECONDS_IN_A_DAY);
97+
9598
```
9699
**[⬆ back to top](#table-of-contents)**
97100

0 commit comments

Comments
 (0)