From 79b6f8cb2b3f7fbde06c7d821fc92e0a2682d340 Mon Sep 17 00:00:00 2001 From: Emilly Date: Tue, 1 Nov 2022 16:05:01 -0300 Subject: [PATCH] 07-resolvido --- 07-sumEven/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/07-sumEven/index.js b/07-sumEven/index.js index bb1e095..c89a75f 100644 --- a/07-sumEven/index.js +++ b/07-sumEven/index.js @@ -1,4 +1,17 @@ +import { sum } from "../06-sum"; + export function sumEven(value) { // implementar logica aqui - + let par = [] + for (let i = 0; i < value.length; i++) { + if (value[i] % 2 == 0) { + par.push(value[i]) + } + } + let total = 0 + for (let i = 0; i < par.length; i++) { + total += par[i]; + } + value = []; + return total; } \ No newline at end of file