re: .map(), .filter(), and .reduce() VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I still dont get the .reduce() 😔
 

That’s ok! It took me a long time to get it. Reduce is useful because you get a single value returned from an array of values. For example, if you have an array and you need to total of all the numbers.

The accumulator is just the total up to that point and the currentValue is just the value at whatever index you are currently at. So if you are adding, it’ll be the total + the value and then repeat until it’s gone through every number in the array and return the value of the last operation. Hope this helps! Try playing with the MDN examples they may help too!

code of conduct - report abuse