top | item 10424119 (no title) ahoge | 10 years ago The reduce one needs an initial value of 0 for that to work. Then both versions will return 0 if the array is empty. array.reduce((a, b) => a + b, 0); discuss order hn newest No comments yet.
No comments yet.