Skip to content

Commit

Permalink
Add note about default arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmcdermott committed Jan 26, 2017
1 parent 348760e commit 471371e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ function paintCar(car) {
**[ back to top](#table-of-contents)**

### Use default arguments instead of short circuiting or conditionals
Default arguments are often cleaner than short circuiting. Be aware that if you
use them, your function will only provide default values for `undefined`
arguments. Other "falsy" values such as `''`, `""`, `false`, `null`, `0`, and
`NaN`, will not be replaced by a default value.

**Bad:**
```javascript
Expand Down

0 comments on commit 471371e

Please sign in to comment.