r/learnjavascript • • Mar 24 '20

Array Reduce Explained in 80 Seconds

https://youtu.be/lxT4LZdtJrU
70 Upvotes

25 comments sorted by

View all comments

10

u/Abiv23 Mar 24 '20

big portion missing from this 'tutorial', reduce also has a third parameter (accumulative total, current item, current index)

2

u/Mises2Peaces Mar 24 '20

Do you current index a lot in reduce?

2

u/[deleted] Mar 24 '20

i dont

2

u/Mises2Peaces Mar 24 '20

Me neither. I'm wondering if I'm missing something useful.

1

u/[deleted] Mar 24 '20

Well check out mdn reduce so you'll see when it would be useful to use the index.

i think I've needed to use it once but that was for some problem on codewars