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

5 lines
146 B
JavaScript
Raw Normal View History

export function isPrime(value) {
2022-10-29 17:16:32 +00:00
var start = 2;
while (start <= Math.sqrt(value)) if (value % start++ < 1) return false;
return value > 1;
}