mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 02:08:19 -05:00
Amend grammar for default parameters
This commit is contained in:
@@ -551,9 +551,9 @@
|
||||
}
|
||||
```
|
||||
|
||||
- Don't put side effect into default parameter
|
||||
- Avoid side effects with default parameters
|
||||
|
||||
> it introduces confusion and subtlety. Arguments in function call are evaluated at call site, but default parameters are not evaluated at define site.
|
||||
> Why? They are confusing to reason about.
|
||||
|
||||
```javascript
|
||||
var b = 1;
|
||||
|
||||
Reference in New Issue
Block a user