feat(isPrime): adicionando resolucao desafio 5

isPrime
This commit is contained in:
Bernardo Cunha Ernani Waldhelm 2022-10-28 13:46:14 -03:00
parent aaf3badf7b
commit e9ebef8951

View File

@ -1,4 +1,22 @@
export function isPrime(value) {
// implementar logica aqui
let totalDivisores = 0;
for (let i = 1; i <= value; i++) {
if (value % i == 0) {
totalDivisores++
}
}
if (totalDivisores == 2) {
return true;
} else return false
if (value === 2) {
return true;
}
if (value === 1) {
return false;
}
}