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

13 lines
215 B
JavaScript
Raw Normal View History

export function sum(values) {
// implementar logica aqui
2022-10-28 13:39:05 +00:00
if (values.length === 0) {
return 0;
}
let sum = values.reduce(function(accumulator,value){
return accumulator + value;
})
return sum
}