forked from M3-Academy/challenge-algorithms-v2.0
Merge pull request 'feat(challenge-7): completed challenge' (#7) from feature/challenge-7 into develop
Reviewed-on: #7
This commit is contained in:
commit
cf4ef58cce
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user