A Guide To The Reduce Method In Javascript​
Josh Pitzalis
98412

thx for this amazing article, and i spotted just one thing, you can not use the word function as an argument on the pipeline exemple, probably because it s a reserved word, i spent almost half an hour trying to debug hhhh and finally figured out that i had to change it.

this is the right way to use it :

let pipeline = [increment, double, decrement];
const result = pipeline.reduce((total, func) => {
 return func(total);
}, 1);

Show your support

Clapping shows how much you appreciated Ma'mun mokni’s story.