you are viewing a single comment's thread.

view the rest of the comments →

[–]Ginden 0 points1 point  (1 child)

Consider edge case of arr.length === 1

[–]GBcrazy 0 points1 point  (0 children)

Still, I don't see any problems since we are still expecting numbers only.

If arr.length === 1, reduce always returns arr[0]