mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 21:48:05 -05:00
Merge pull request #1616 from leonidlebedev/patch-1
Remove unnecessary variables
This commit is contained in:
@@ -405,14 +405,12 @@ Other Style Guides
|
||||
[1, 2, 3].map(x => x + 1);
|
||||
|
||||
// bad - no returned value means `memo` becomes undefined after the first iteration
|
||||
const flat = {};
|
||||
[[0, 1], [2, 3], [4, 5]].reduce((memo, item, index) => {
|
||||
const flatten = memo.concat(item);
|
||||
memo[index] = flatten;
|
||||
});
|
||||
|
||||
// good
|
||||
const flat = {};
|
||||
[[0, 1], [2, 3], [4, 5]].reduce((memo, item, index) => {
|
||||
const flatten = memo.concat(item);
|
||||
memo[index] = flatten;
|
||||
|
||||
Reference in New Issue
Block a user