re: Understanding reduce in JavaScript VIEW POST


That's why it's important use well named variables, imagine that your first approach with reduce was this way:
arr.reduce((accumulator, currentValue) => accumulator + currentValue);

Much better, don't you think so? It's almost self explanatory...


I'm pretty sure I would still have found a way to be confused by it, hahaha

But I do agree that clear naming goes a long way to help understand code.

code of conduct - report abuse