forked from M3-Academy/challenge-algorithms-v2.0
22 lines
342 B
JavaScript
22 lines
342 B
JavaScript
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;
|
|
}
|
|
} |