challenge-algorithms-v2.0-e.../05-isPrime/index.js
2022-10-29 14:16:32 -03:00

5 lines
146 B
JavaScript

export function isPrime(value) {
var start = 2;
while (start <= Math.sqrt(value)) if (value % start++ < 1) return false;
return value > 1;
}