feat: solucao sumEven #7

Merged
Rafael_Sampaio_de_Oliveira merged 1 commits from feature/solucao-sumEven into development 2022-10-28 13:50:20 +00:00
Showing only changes of commit bb9ac73956 - Show all commits

View File

@ -1,4 +1,15 @@
export function sumEven(value) {
// implementar logica aqui
}
let pair = (x) => x % 2 === 0;
if (value.length === 0) {
return 0;
} else if (value % 2 === 1) {
return 0;
} else {
let sumOfPairs = value
.filter(pair)
.reduce((pairs, number) => pairs + number);
return sumOfPairs;
}
}