challenge-algorithms-v2.0-m.../06-sum/index.js
2022-11-02 18:04:26 -03:00

7 lines
160 B
JavaScript

export function sum(values) {
if (values.length == 0) return 0;
const val = values.reduce((accumulator, value) => accumulator + value, 0);
return val;
}