add sumEven logic

This commit is contained in:
Marcela Mathias 2022-11-02 19:15:45 -03:00
parent 0696bbec7e
commit ec14b1acd0

View File

@ -1,4 +1,12 @@
export function sumEven(value) {
// implementar logica aqui
if (value.length == 0 || value.length == 1) return 0;
let result = 0;
value.forEach((item, index) => {
if (item % 2 == 0) {
return (result = result + item);
}
});
return result;
}