challenge-algorithms-v2.0-v.../05-isPrime/index.js
2022-10-28 08:00:31 -03:00

15 lines
220 B
JavaScript

export function isPrime(value) {
let prime;
let cont = 0;
for (let i = 0; i <= value; i++) {
if (value % i === 0) {
cont++;
}
}
if (cont > 2) {
return false;
} else {
return true;
}
}