[ong] swap order of new entry

This commit is contained in:
johnmanong
2015-08-31 18:29:35 -04:00
parent 701cbb954d
commit eeed55c154

View File

@@ -556,21 +556,7 @@ Other Style Guides
}
```
- [7.8](#7.8) <a name='7.8'></a> Always put default parameters last.
```javascript
// bad
function handleThings(opts = {}, name) {
// ...
}
// good
function handleThings(name, opts = {}) {
// ...
}
```
- [7.9](#7.9) <a name='7.9'></a> Avoid side effects with default parameters.
- [7.8](#7.8) <a name='7.8'></a> Avoid side effects with default parameters.
> Why? They are confusing to reason about.
@@ -586,6 +572,20 @@ Other Style Guides
count(); // 3
```
- [7.9](#7.9) <a name='7.9'></a> Always put default parameters last.
```javascript
// bad
function handleThings(opts = {}, name) {
// ...
}
// good
function handleThings(name, opts = {}) {
// ...
}
```
- [7.10](#7.10) <a name='7.10'></a> Never use the Function constructor to create a new function.
> Why? Creating a function in this way evaluates a string similarly to eval(), which opens vulnerabilities.