forked from M3-Academy/challenge-algorithms-v2.0
18 lines
362 B
JavaScript
18 lines
362 B
JavaScript
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
|
|
|
|
} |