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

14 lines
268 B
JavaScript

export function isPrime(value) {
// implementar logica aqui
let Prime = true;
for (let i = 2; i < value; i++) {
if (value % i === 0) {
Prime = false;
break;
}
}
if (Prime === true && value === 1) {
Prime = false;
}
return Prime;
}