feat(challenge-7): completed challenge

This commit is contained in:
Henrique Santos Santana 2022-10-27 21:12:10 -03:00
parent e650ec9d21
commit 8d7b786b23

View File

@ -1,4 +1,13 @@
export function sumEven(value) { export function sumEven(value) {
// implementar logica aqui // implementar logica aqui
if (value.length === 0 || !value) return 0;
}
// acc é abreviação de accumulator(acumulador)
return value.reduce((acc, number) => {
if (number % 2 === 0) {
return (acc += number);
}else {
return acc += 0
}
}, 0);
}