feat(isPrime): adiciona funcao que verifica se o parametro e primo

This commit is contained in:
Vinicius 2022-11-02 18:58:17 -02:00
parent 22d3d27b2c
commit 714e56e802

View File

@ -1,4 +1,25 @@
export function isPrime(value) {
// implementar logica aqui
let primo;
if (
number == 2 ||
number == 3 ||
number == 5 ||
number == 7 ||
number == 11 ||
number == 13
) {
primo = true;
} else {
primo =
number % 2 != 0 &&
number % 3 != 0 &&
number % 5 != 0 &&
number % 7 != 0 &&
number % 11 != 0 &&
number % 13 != 0
? "true"
: "false";
}
return primo;
}