Skip to content

Commit 417f989

Browse files
author
Tomek Wiszniewski
committed
Bring back explicit return in 8.1 example
1 parent 60360bd commit 417f989

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,11 +593,15 @@
593593
```javascript
594594
// bad
595595
[1, 2, 3].map(function (x) {
596-
return x * x;
596+
const y = x + 1;
597+
return x * y;
597598
});
598599

599600
// good
600-
[1, 2, 3].map(x => x * x);
601+
[1, 2, 3].map((x) => {
602+
const y = x + 1;
603+
return x * y;
604+
});
601605
```
602606
603607
- [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.

0 commit comments

Comments
 (0)