From a0fe55c0cdfec194907a23ea6cc6263fe97daf38 Mon Sep 17 00:00:00 2001 From: Paul Montoya <52388061+PaulMoro@users.noreply.github.com> Date: Sun, 19 Jul 2020 22:28:08 -0500 Subject: [PATCH 1/2] Finish Challenge 04 javascript --- src/index.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 4c197d6..a83c6d8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,17 @@ const trialDivision = (number) => { - + var i, divi=0; + + for(i = 1; i <= number; i++) { + + if(number % i == 0) { + divi++; + } + } + + if(divi == 2) { + return true; + } else { + return false; } - - module.exports = trialDivision; \ No newline at end of file +} +module.exports = trialDivision; From 7943416e4de7f49e444ef8fbe6523ef0ed4006b0 Mon Sep 17 00:00:00 2001 From: Paul Montoya <52388061+PaulMoro@users.noreply.github.com> Date: Sun, 19 Jul 2020 22:29:44 -0500 Subject: [PATCH 2/2] finish Challenge 04 javascript --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index a83c6d8..f71d5af 100644 --- a/src/index.js +++ b/src/index.js @@ -1,14 +1,14 @@ const trialDivision = (number) => { - var i, divi=0; + let i, divisor = 0; for(i = 1; i <= number; i++) { if(number % i == 0) { - divi++; + divisor++; } } - if(divi == 2) { + if(divisor == 2) { return true; } else { return false;