From a3ba7348e9cf4e66cb0a75da694c0e59f58f048f Mon Sep 17 00:00:00 2001 From: Gabriel Gomes Date: Mon, 31 Oct 2022 13:55:02 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Adiciona=20o=20c=C3=B3digo=20do=20desaf?= =?UTF-8?q?io=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..e61acdc 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,9 @@ export function isPrime(value) { // implementar logica aqui + if (value === 0 || value === 1) return false; + for (let i = 2; i <= Math.sqrt(value); i++) { + if (value % i === 0) return false; + } + return true; } \ No newline at end of file