From d355e811b4845a530883318a2d254a71882d0bcc Mon Sep 17 00:00:00 2001 From: Nicolly Vieira Date: Fri, 28 Oct 2022 14:57:35 -0300 Subject: [PATCH] feat(isPrime): funcao feita --- 05-isPrime/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..9f717e6 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,11 @@ export function isPrime(value) { // implementar logica aqui - + let quantidadeDeDivisores = 0 + for (let i = 1; i <= value; i++) { + if (value % i == 0) { + quantidadeDeDivisores++ + } + } + + return quantidadeDeDivisores == 2 ? true : false; } \ No newline at end of file