Skip to content
loading...

re: JavaScript’s Reduce Method Explained By Going On a Diet VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I don't fully understand why there is a 0 after the parameters, could you explained please? :)
 

reduce takes two arguments, a function that calculates the next vaue for the accumulator (sum in this case) and an initial value (0).

Parameter 1: (sum, {calories}) => sum + calories
Parameter 2: 0

code of conduct - report abuse