From 63134d4cd8f17f2fd27fa1293a5d090adf4b853b Mon Sep 17 00:00:00 2001 From: Efrain Hernandez Date: Wed, 16 Sep 2020 00:31:04 -0500 Subject: [PATCH 1/2] Solucion reto 4 JavaScript PlatziMaster --- src/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/index.js b/src/index.js index 4c197d6..640e715 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,27 @@ const trialDivision = (number) => { + let modulo = 0; + + if(number > 1) { + let contador = 0; + + for(let i = 1; i <= number; i++) { + modulo = number % i; + if(modulo === 0) { + contador++; + } + + } + + if(contador === 2) + return true; + + if (contador !== 2) + return false; + + } else + return false; + } module.exports = trialDivision; \ No newline at end of file From 9a0cafbf0359779f131e2915c8c85210a8ea8ce4 Mon Sep 17 00:00:00 2001 From: Efrain Hernandez Date: Wed, 16 Sep 2020 00:32:15 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Soluci=C3=B3n=20al=20reto=20numeros=20primo?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 640e715..adbc0c7 100644 --- a/src/index.js +++ b/src/index.js @@ -23,5 +23,5 @@ const trialDivision = (number) => { } - + module.exports = trialDivision; \ No newline at end of file