In your example, by chance it didn't hurt because A) both the array and the accumulated value are numbers, and B) addition is commutative, but if your operation was not, or if your accumulated value was of a different type, this would become more important.
I hope that is helpful! Thank you for writing interesting and useful articles!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article @Ali !
Just one correction, regarding meaningful names, this is actually misleading:
In a reduce, the first parameter is the accumulated value, and the second is the next item from the array. So it should be:
In your example, by chance it didn't hurt because A) both the array and the accumulated value are numbers, and B) addition is commutative, but if your operation was not, or if your accumulated value was of a different type, this would become more important.
I hope that is helpful! Thank you for writing interesting and useful articles!