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

12 lines
276 B
JavaScript
Raw Normal View History

export function isPrime(value) {
// implementar logica aqui
if (value == 0 || value == 1) {
return false;
2022-10-28 13:31:56 +00:00
}
for (let div = 2; div <= Math.sqrt(value); div++) {
if (value % div == 0) {
return false;
}
}
return true;
}