forked from M3-Academy/challenge-algorithms-v2.0
16 lines
316 B
JavaScript
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;
|
|
} |