Skip to content

Commit 495a62a

Browse files
mapbljharb
authored andcommitted
[guide] fix example 4.7 for arrays method callbacks
1 parent da0cf08 commit 495a62a

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,11 @@ Other Style Guides
423423
// bad - no returned value means `acc` becomes undefined after the first iteration
424424
[[0, 1], [2, 3], [4, 5]].reduce((acc, item, index) => {
425425
const flatten = acc.concat(item);
426-
acc[index] = flatten;
427426
});
428427

429428
// good
430429
[[0, 1], [2, 3], [4, 5]].reduce((acc, item, index) => {
431430
const flatten = acc.concat(item);
432-
acc[index] = flatten;
433431
return flatten;
434432
});
435433

0 commit comments

Comments
 (0)