Skip to content

Commit bf74957

Browse files
Merge pull request ryanmcdermott#47 from Tarabass/master
Improve example "Function names should say what they do"
2 parents 0c4fa28 + f350f2b commit bf74957

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,24 @@ function isClientActive(client) {
275275

276276
**Bad:**
277277
```javascript
278-
function dateAdd(date, month) {
278+
function addToDate(date, month) {
279279
// ...
280280
}
281281

282282
const date = new Date();
283283

284284
// It's hard to to tell from the function name what is added
285-
dateAdd(date, 1);
285+
addToDate(date, 1);
286286
```
287287

288288
**Good**:
289289
```javascript
290-
function dateAddMonth(date, month) {
290+
function addMonthToDate(month, date) {
291291
// ...
292292
}
293293

294294
const date = new Date();
295-
dateAddMonth(date, 1);
295+
addMonthToDate(date, 1);
296296
```
297297
**[⬆ back to top](#table-of-contents)**
298298

0 commit comments

Comments
 (0)