I am now looking at the following post
Javascript Algorithm Attempting to Implement Call Back Function. I can understand the other parts but particularly confuse at the following code.
const sum = integerSet.reduce((total, item) => total + Math.pow(item, pow), 0);.
So, what is the purpose of adding 0 at the end and if we change from arrow function to normal function would it be change to this? sum = integerSet.reduce(function(total, item) { return total + Math.pow(item,power),0; })
I have searched up the several reduce methods usage but still can't get the clear figure of how he use there so I decided to ask it here.
The 0 gives you the starting point. From there everything will be calculated "on top" of this accumulator. So in your example the 0 would be the item to start with.