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

17 lines
195 B
JavaScript
Raw Normal View History

export function isPrime(value) {
2022-10-28 23:53:25 +00:00
if(value <= 1){
return false;
}
2022-10-28 23:53:25 +00:00
for (let i = 2; i < value; i++ ){
if (value % i === 0) {
return false;
}
}
return true;
}