From 25cbe458a0b7094ab1b4df9d9cea99558c2a1cb0 Mon Sep 17 00:00:00 2001 From: LeonardoPereiraRocha Date: Fri, 28 Oct 2022 21:37:59 -0300 Subject: [PATCH] =?UTF-8?q?feat(07-sumEven):=20Cria=20a=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..fc7e880 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,8 @@ export function sumEven(value) { - // implementar logica aqui - + let sum = 0; + for (let i = 0; i < value.length; i++) { + if (value[i] % 2 === 0) { + sum += value[i]; + } + } return sum; } \ No newline at end of file