challenge-algorithms-v2.0-e.../05-isPrime/index.js

18 lines
340 B
JavaScript
Raw Normal View History

export function isPrime(value) {
// implementar logica aqui
2022-11-01 16:53:50 +00:00
let TotalDeivisores = 0;
for (let i = 1; i <= value; i++) {
if (value % i == 0) {
TotalDeivisores++
}
}
if (TotalDeivisores == 2){
return true;
} else return false;
if (value === 2){
return true;
}
if (value === 1){
return false;
}
}