Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c51251d

Browse files
committed
[guide] add section on multiline function signatures/invocations
1 parent f9a5dd4 commit c51251d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,39 @@ Other Style Guides
810810
new Date(...[2016, 08, 05]);
811811
```
812812

813+
<a name="functions--signature-invocation-indentation"></a>
814+
- [7.15](#functions--signature-invocation-indentation) Functions with multiline signatures, or invocations, should be indented just like every other multiline list in this guide: with each item on a line by itself, with a trailing comma on the last item.
815+
816+
```javascript
817+
// bad
818+
function foo(bar,
819+
baz,
820+
quux) {
821+
// body
822+
}
823+
824+
// good
825+
function foo(
826+
bar,
827+
baz,
828+
quux,
829+
) {
830+
// body
831+
}
832+
833+
// bad
834+
console.log(foo,
835+
bar,
836+
baz);
837+
838+
// good
839+
console.log(
840+
foo,
841+
bar,
842+
baz,
843+
);
844+
```
845+
813846
**[⬆ back to top](#table-of-contents)**
814847

815848
## Arrow Functions

0 commit comments

Comments
 (0)