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

14 lines
224 B
JavaScript
Raw Normal View History

export function sum(values) {
// implementar logica aqui
2022-10-29 20:34:11 +00:00
let soma = 0
if(values.length == 0) return 0
for (let i = 0; i < values.length; i++) {
soma += values[i]
}
return soma
2022-10-29 20:34:11 +00:00
}
sum([1, 2, 3, 4, 5])