challenge-algorithms-v2.0-m.../07-sumEven/index.js

16 lines
316 B
JavaScript

export function sumEven(value) {
// implementar logica aqui
let total = 0
let even = []
for (let i = 0; i < value.length; i++) {
if (value[i] % 2 == 0) {
even.push(value[i])
}
}
for (let i = 0; i < even.length; i++)
{
total += even[i];
}
return total;
}