forked from M3-Academy/challenge-algorithms-v2.0
feat: resolucao funcao sum
This commit is contained in:
parent
938bfcee0f
commit
10b8d54684
@ -1,4 +1,14 @@
|
||||
export function sum(values) {
|
||||
// implementar logica aqui
|
||||
let soma = 0
|
||||
|
||||
if(values.length == 0) return 0
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
soma += values[i]
|
||||
}
|
||||
return soma
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sum([1, 2, 3, 4, 5])
|
Loading…
Reference in New Issue
Block a user