Solve the mathematical problem of prime numbers with JavaScript code example
Example: javascript find prime number
function test_prime(n){
if (n===1) {
return false;
}else if(n === 2){
return true;
}else{
for(var x = 2; x < n; x++){
if(n % x === 0){
return false;
}
}
return true;
}
}
console.log(test_prime(37));