From 3bc3385c9fdcaa46b2d4f3d723fd2a4feeb04b20 Mon Sep 17 00:00:00 2001 From: Ramon Dias Ferreira Date: Tue, 1 Nov 2022 22:18:37 -0300 Subject: [PATCH] feat(sumEven): filter utilizado para retornar numeros pares e um for para fazer a soma do array --- 07-sumEven/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..b17535e 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,11 @@ export function sumEven(value) { // implementar logica aqui - -} \ No newline at end of file + var retorno = value.filter(pares => (pares %2)== 0); + let soma = 0 + for(let i in retorno) { + soma += retorno[i] + } + return soma +} + +