| 
602 | 602 | 
  | 
603 | 603 |   - [8.2](#8.2) <a name='8.2'></a> If the function body consists of a single expression, feel free to omit the braces and use the implicit return. Otherwise use a `return` statement.  | 
604 | 604 | 
  | 
605 |  | -    In case the expression spans over multiple lines, wrap it in parentheses for better readability.  | 
606 |  | -
  | 
607 | 605 |   > Why? Syntactic sugar. It reads well when multiple functions are chained together.  | 
608 | 606 | 
  | 
609 | 607 |   > Why not? If you plan on returning an object.  | 
 | 
612 | 610 |     // good  | 
613 | 611 |     [1, 2, 3].map(number => `A string containing the ${number}.`);  | 
614 | 612 | 
 
  | 
615 |  | -    // good  | 
616 |  | -    [1, 2, 3].map(number => (  | 
617 |  | -      `As time went by, the string containing the ${number} became much ` +  | 
618 |  | -      'longer. So we needed to break it over multiple lines.'  | 
619 |  | -    ));  | 
620 |  | - | 
621 | 613 |     // bad  | 
622 | 614 |     [1, 2, 3].map(number => {  | 
623 | 615 |       let nextNumber = number + 1;  | 
 | 
631 | 623 |     });  | 
632 | 624 |     ```  | 
633 | 625 | 
  | 
634 |  | -  - [8.3](#8.3) <a name='8.3'></a> If your function only takes a single argument, feel free to omit the parentheses.  | 
 | 626 | +  - [8.3](#8.3) <a name='8.3'></a> In case the expression spans over multiple lines, wrap it in parentheses for better readability.  | 
 | 627 | +
  | 
 | 628 | +  > Why? It shows clearly where the function starts and ends.  | 
 | 629 | +
  | 
 | 630 | +    ```js  | 
 | 631 | +    // bad  | 
 | 632 | +    [1, 2, 3].map(number => 'As time went by, the string containing the ' +  | 
 | 633 | +      `${number} became much longer. So we needed to break it over multiple ` +  | 
 | 634 | +      'lines.'  | 
 | 635 | +    );  | 
 | 636 | + | 
 | 637 | +    // good  | 
 | 638 | +    [1, 2, 3].map(number => (  | 
 | 639 | +      `As time went by, the string containing the ${number} became much ` +  | 
 | 640 | +      'longer. So we needed to break it over multiple lines.'  | 
 | 641 | +    ));  | 
 | 642 | +    ```  | 
 | 643 | +
  | 
 | 644 | +
  | 
 | 645 | +  - [8.4](#8.4) <a name='8.4'></a> If your function only takes a single argument, feel free to omit the parentheses.  | 
635 | 646 | 
  | 
636 | 647 |     > Why? Less visual clutter.  | 
637 | 648 | 
  | 
 | 
0 commit comments