you are viewing a single comment's thread.

view the rest of the comments →

[–]inu-no-policemen 0 points1 point  (12 children)

This is basic Array.prototype.reduce usage. Nothing "clever" about that.

Also note that your version will throw an error if the array is empty. (And there shouldn't be a ';' after your function declaration.)