DEV Community

Discussion on: Javascript's reduce method in a nutshell.

Collapse
 
basharath profile image
Basharath

It's a good article. You should avoid saying previous value, because it doesn't actually hold the previous value.

previousValue accumulates all the results, nothing but the squeezing of the array is stored in that. So it is a convention to call it an accumulator or store.

General convention
arr.reduce((acc, curr) => {}, initial)👍

Collapse
 
amiinequ profile image
Amine Amhoume

I appreciate that. You are definitely right! But, the thing I try to write articles for people with low level English and not to confuse them with puzzling words. Thank you again.

Collapse
 
mfurmaniuk profile image
Michael

As a native speaker I found the previous and current more confusing to be honest. Very nice that you can do this sort of thing in JS but I did have to reread your example a couple of times as it didn't sound right to me.

Thread Thread
 
amiinequ profile image
Amine Amhoume

Thank you Michael. Feedback like yours is what keeps me improving. I will take that in consideration when writing my next article which I will publish in a few days.