Bring back explicit return in 8.1 example

This commit is contained in:
Tomek Wiszniewski
2015-08-13 08:47:48 +02:00
parent 60360bdedd
commit 417f9896d0

View File

@@ -593,11 +593,15 @@
```javascript
// bad
[1, 2, 3].map(function (x) {
return x * x;
const y = x + 1;
return x * y;
});
// good
[1, 2, 3].map(x => x * x);
[1, 2, 3].map((x) => {
const y = x + 1;
return x * y;
});
```
- [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.