From 5b3f283516551648e4942b2567758e4dfee37743 Mon Sep 17 00:00:00 2001 From: Caio Thurler Date: Mon, 31 Oct 2022 14:56:24 -0300 Subject: [PATCH] refactor: funcao sumEven --- 07-sumEven/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index c5e092f..4a14829 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,12 +1,12 @@ export function sumEven(value) { // implementar logica aqui - let total = 0 let pares = [] for (let i = 0; i < value.length; i++) { if (value[i] % 2 == 0) { pares.push(value[i]) } } + let total = 0 for (let i = 0; i < pares.length; i++) { total += pares[i]; // adiciona o valor do indice (que aumenta com o loop) no total }