We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a56f239 commit 1df9825Copy full SHA for 1df9825
1 file changed
README.md
@@ -1309,7 +1309,6 @@ Other Style Guides
1309
for (let num of numbers) {
1310
sum += num;
1311
}
1312
-
1313
sum === 15;
1314
1315
// good
@@ -1320,6 +1319,19 @@ Other Style Guides
1320
1319
// best (use the functional force)
1321
const sum = numbers.reduce((total, num) => total + num, 0);
1322
+
1323
+ // bad
1324
+ const modified = [];
1325
+ for (let i = 0; i < numbers.length; i++) {
1326
+ modified.push(numbers[i] + 1);
1327
+ }
1328
1329
+ // good
1330
1331
+ numbers.forEach(num => modified.push(num + 1));
1332
1333
+ // best (keeping it functional)
1334
+ const modified = numbers.map(num => num + 1);
1335
```
1336
1337
<a name="generators--nope"></a><a name="11.2"></a>
0 commit comments