Thanks for the reply, it is an interesting view. While I understand that the for..of cycles remedy some of the problems I have with cycles, I still prefer the reduce.
I admit that for something so simple as a sum there is a little advantage, but this was chosen as an illustration for the problem exactly for the simplicity of the problem.
What I wholeheartedly agree with you on is that the all the operators (including the function call operator) in JavaScript should be functions as well.
Log in to continue
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the reply, it is an interesting view. While I understand that the
for..of
cycles remedy some of the problems I have with cycles, I still prefer thereduce
.I admit that for something so simple as a sum there is a little advantage, but this was chosen as an illustration for the problem exactly for the simplicity of the problem.
What I wholeheartedly agree with you on is that the all the operators (including the function call operator) in JavaScript should be functions as well.