forked from M3-Academy/challenge-algorithms-v2.0
12 lines
205 B
JavaScript
12 lines
205 B
JavaScript
export function sum(values) {
|
|
let soma = 0;
|
|
for (let i = 0; i < values.length; i++) {
|
|
if (values[i].length === 0) {
|
|
soma = 0;
|
|
} else {
|
|
soma += values[i];
|
|
}
|
|
}
|
|
return soma;
|
|
|
|
} |