Sum of an Array

Arrays ยท easy

Implement `sum(arr)` that returns the sum of all numbers in `arr`. Return `0` for an empty array.

Hints
  • Reduce accumulates a single value from the array.

Learning resources

Loading...

Run your code to see results.