From 10d6d20998212b45af3e80a5aa5cc4d208f085d6 Mon Sep 17 00:00:00 2001 From: Emmanuel Vitor Date: Mon, 31 Oct 2022 13:52:10 -0300 Subject: [PATCH] =?UTF-8?q?feat:cria=20algoritmo=20que=20retorne=20a=20som?= =?UTF-8?q?a=20de=20todos=20os=20n=C3=BAmeros=20pares=20de=20um=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..d92dc75 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,11 @@ export function sumEven(value) { // implementar logica aqui - + let resultEvenSum = 0; + value.forEach(element => { + if ((element % 2) === 0) { + resultEvenSum += element; + } + }); + + return resultEvenSum; } \ No newline at end of file