forked from M3-Academy/challenge-algorithms-v2.0
10 lines
209 B
JavaScript
10 lines
209 B
JavaScript
export function isPrime(value) {
|
|
if (value <= 1) return false;
|
|
|
|
for (let divisor = 2; divisor <= Math.sqrt(value); divisor++) {
|
|
if (value % divisor === 0) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
} |