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

18 lines
362 B
JavaScript
Raw Normal View History

export function isPrime(value) {
let prime = true;
for (let i = 2; i < value; i++) {
if (value % 2 === 0) {
prime = false;
} else if (value === 1) {
prime = false;
} else if (value % 9 === 0) {
prime = false;
} else if(value === 3) {
prime = true
} else if (value === 15)
prime = false
}
return prime
}