From ed34bb7d8e068f5e88381767f57a2aba9ddb5b06 Mon Sep 17 00:00:00 2001 From: RodrigoJorge Date: Fri, 28 Oct 2022 15:35:28 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20implementa=20fun=C3=A7=C3=A3o=20isPrime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..29ecf74 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,15 @@ export function isPrime(value) { // implementar logica aqui - + if(value == 2){ + return true; + } + else if (value == 1){ + return false + } + for(let i = 2; i < value; i++){ + if(value % i == 0){ + return false + } + } + return true; } \ No newline at end of file