forked from M3-Academy/challenge-algorithms-v2.0
7 lines
160 B
JavaScript
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;
|
|
}
|