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

11 lines
147 B
JavaScript
Raw Permalink Normal View History

export function sum(values) {
2022-10-28 23:36:08 +00:00
if (values.length) {
return values.reduce(function (soma, i) {
return soma + i
})
}
return 0
}