Calculates the sum of numbers in an array.
const numbers = [1, 2, 3, 4] as const;const negatives = [3, -2, 5] as const;const total = Arr.sum(numbers);const totalNegatives = Arr.sum(negatives);assert(total === 10);assert(totalNegatives === 6); Copy
const numbers = [1, 2, 3, 4] as const;const negatives = [3, -2, 5] as const;const total = Arr.sum(numbers);const totalNegatives = Arr.sum(negatives);assert(total === 10);assert(totalNegatives === 6);
Calculates the sum of numbers in an array.