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

Skip to content

Commit fd293bc

Browse files
committed
Improve example "Function names should say what they do"
1 parent 2837f0f commit fd293bc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,24 @@ function isClientActive(client) {
295295

296296
**Bad:**
297297
```javascript
298-
function dateAdd(date, month) {
298+
function addToDate(date, month) {
299299
// ...
300300
}
301301

302302
let date = new Date();
303303

304304
// It's hard to to tell from the function name what is added
305-
dateAdd(date, 1);
305+
addToDate(date, 1);
306306
```
307307

308308
**Good**:
309309
```javascript
310-
function dateAddMonth(date, month) {
310+
function addMonthToDate(date, month) {
311311
// ...
312312
}
313313

314314
let date = new Date();
315-
dateAddMonth(date, 1);
315+
addMonthToDate(date, 1);
316316
```
317317
**[⬆ back to top](#table-of-contents)**
318318

0 commit comments

Comments
 (0)