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

4 lines
152 B
JavaScript

export function sum(values) {
if(values.length < 1) return 0;
return values.reduce((previousValue, currentValue) => previousValue + currentValue);
}