From 0de9bd577c348631f53fa5f712e72185293d8f1c Mon Sep 17 00:00:00 2001 From: Affonsok Date: Sun, 30 Oct 2022 15:33:26 -0300 Subject: [PATCH] =?UTF-8?q?feat(isPrime):=20Responde=20fun=C3=A7=C3=A3o=20?= =?UTF-8?q?05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index 9412ea0..0880725 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,16 @@ export function isPrime(value) { // implementar logica aqui - + { if ( value === 1 ) { + return false; + } else if ( value === 2 ) { + return true; + } else { + for ( var x = 2; x < value; x++ ) { + if ( value % x === 0 ) { + return false; + } + } + return true; + } + } } \ No newline at end of file