diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..ac5407e 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,15 @@ export function sumEven(value) { // implementar logica aqui - -} \ No newline at end of file + 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; + } +}