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

6 lines
132 B
JavaScript

export function isPrime(value) {
for (var i = 2; i < value; i++)
if (value % i === 0) return false;
return value !== 1;
}