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

12 lines
264 B
JavaScript
Raw Permalink Normal View History

export function sumEven(value) {
// implementar logica aqui
2022-10-28 13:42:47 +00:00
const newArray = value;
var i;
let total = 0;
for (i = 0; i < newArray.length; i++) {
if (newArray[i] % 2 === 0) {
total = total + newArray[i];
}
2022-10-28 13:42:47 +00:00
}
return total;
}