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

18 lines
316 B
JavaScript
Raw Permalink Normal View History

export function sum(values) {
// implementar logica aqui
let soma = 0;
let numbers = values
if (numbers == `${[]}`) {
return 0;
}
else{
for(let i=0; i< numbers.length; i++){
soma = soma + numbers[i];
}
return soma
}
}