Skip to content

Commit eeed55c

Browse files
committed
[ong] swap order of new entry
1 parent 701cbb9 commit eeed55c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -556,21 +556,7 @@ Other Style Guides
556556
}
557557
```
558558
559-
- [7.8](#7.8) <a name='7.8'></a> Always put default parameters last.
560-
561-
```javascript
562-
// bad
563-
function handleThings(opts = {}, name) {
564-
// ...
565-
}
566-
567-
// good
568-
function handleThings(name, opts = {}) {
569-
// ...
570-
}
571-
```
572-
573-
- [7.9](#7.9) <a name='7.9'></a> Avoid side effects with default parameters.
559+
- [7.8](#7.8) <a name='7.8'></a> Avoid side effects with default parameters.
574560
575561
> Why? They are confusing to reason about.
576562
@@ -586,6 +572,20 @@ Other Style Guides
586572
count(); // 3
587573
```
588574
575+
- [7.9](#7.9) <a name='7.9'></a> Always put default parameters last.
576+
577+
```javascript
578+
// bad
579+
function handleThings(opts = {}, name) {
580+
// ...
581+
}
582+
583+
// good
584+
function handleThings(name, opts = {}) {
585+
// ...
586+
}
587+
```
588+
589589
- [7.10](#7.10) <a name='7.10'></a> Never use the Function constructor to create a new function.
590590
591591
> Why? Creating a function in this way evaluates a string similarly to eval(), which opens vulnerabilities.

0 commit comments

Comments
 (0)