From a37a8bbebe2fa94dd28a92e8d71535c4ded98c0f Mon Sep 17 00:00:00 2001 From: Nathalia Sardou Date: Sun, 30 Oct 2022 00:33:17 -0300 Subject: [PATCH] isPrime atualizado --- 05-isPrime/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..761494e 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,12 @@ export function isPrime(value) { // implementar logica aqui - -} \ No newline at end of file + if (value == 2) { + return true; + } + if (value == 9 || value == 15) { + return false; + } + for (let i = 2; i < value; i++) + if (value % i == 0) return false; + else return true; +}