Merge pull request 'feat(challenge-7): completed challenge' (#7) from feature/challenge-7 into develop

Reviewed-on: #7
This commit is contained in:
Henrique Santos Santana 2022-10-28 00:12:46 +00:00
commit cf4ef58cce

View File

@ -1,4 +1,13 @@
export function sumEven(value) {
// 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);
}