The reduce function takes an optional second parameter that indicates the initial value. If I wanted to start counting from 10,that second parameter would have been 10. Here, I wanted to start counting from 0.
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.
Excellent post. This helped a lot. I was wondering, what does the zero do here?:
The reduce function takes an optional second parameter that indicates the initial value. If I wanted to start counting from 10,that second parameter would have been 10. Here, I wanted to start counting from 0.