From 654cb8079dadc94ce22f3a6cd4846f1130e0e23b Mon Sep 17 00:00:00 2001 From: amanda almeida Date: Fri, 28 Oct 2022 15:32:29 -0300 Subject: [PATCH] =?UTF-8?q?feat(sumEven):=20Adiciona=20a=20logica=20do=20a?= =?UTF-8?q?lgoritmo=20que=20retorna=20a=20soma=20de=20todos=20os=20n=C3=BA?= =?UTF-8?q?meros=20pares=20de=20um=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 07-sumEven/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..3ff263d 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,14 @@ export function sumEven(value) { // implementar logica aqui - + let soma = 0; + for (let number of value) { + if (value.length === 0) { + return 0; + } else + + if (number % 2 === 0) { + soma = soma += number; + } + } + return soma; } \ No newline at end of file