File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff 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.
You can’t perform that action at this time.
0 commit comments