challenge-algorithms-v2.0-a.../06-sum/index.js

4 lines
152 B
JavaScript
Raw Normal View History

export function sum(values) {
2022-10-30 17:05:41 +00:00
if(values.length < 1) return 0;
return values.reduce((previousValue, currentValue) => previousValue + currentValue);
}