From f16746faa449547cf235bf3aaf0d80475ee02ed4 Mon Sep 17 00:00:00 2001 From: Gabriel Ferraz Date: Fri, 4 Nov 2022 15:01:09 -0300 Subject: [PATCH] =?UTF-8?q?perfom(Aula2):=20simplifica=C3=A7=C3=A3o=20do?= =?UTF-8?q?=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Aula2.html | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Aula2.html b/Aula2.html index 48c2025..3cc7635 100644 --- a/Aula2.html +++ b/Aula2.html @@ -57,20 +57,14 @@ // return par / 5 function paresPor5() { const numbers = []; + const pares5 = [] for (let i = 0; i < 40; i++) { let numb = Math.floor(Math.random() * 100) + if (numb % 2 === 0 && numb % 5 === 0) {pares5.push(numb)} numbers.push(numb); }; - console.log(numbers); - const pares5 = [] - numbers.forEach(element => { - if (element % 2 === 0 ) { - if (element % 5 === 0) { - pares5.push(element) - } - } - }); - console.log(pares5); + //console.log(numbers); + return pares5; } paresPor5();