Skip to content

Commit 22aea98

Browse files
authored
Merge pull request basarat#394 from jamestharpe/master
Adds missing else in err falsy check
2 parents c28fc71 + 6280a60 commit 22aea98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/javascript/null-undefined.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ Node style callback functions (e.g. `(err,somethingElse)=>{ /* something */ }`)
7373
fs.readFile('someFile', 'utf8', (err,data) => {
7474
if (err) {
7575
// do something
76+
} else {
77+
// no error
7678
}
77-
// no error
7879
});
7980
```
8081
When creating your own APIs it's *okay* to use `null` in this case for consistency. In all sincerity for your own APIs you should look at promises, in that case you actually don't need to bother with absent error values (you handle them with `.then` vs. `.catch`).

0 commit comments

Comments
 (0)