forked from M3-Academy/challenge-algorithms-v2.0
17 lines
234 B
JavaScript
17 lines
234 B
JavaScript
export function isPrime(value) {
|
|
let cont = 0;
|
|
|
|
for(let i = 0; i <= value; i++){
|
|
if (value % i == 0){
|
|
cont++;
|
|
}
|
|
}
|
|
|
|
if(cont == 2){
|
|
return true;
|
|
}
|
|
else{
|
|
return false
|
|
}
|
|
|
|
} |