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));
Also in JavaScript:
- javascript get object from array where property equals
- self invoking function javascript es6
- how to disable right click in javascript
- how to print numbers in javascript
- question mark and colon in javascript
- javascript find matching elements in two arrays
- multilone input react
- javascript get middle of array
- try catch with for loop in javascript
- how to count click events javascript
- timeline material ui react native
- jquery ajax refresh
- add jquery cdn
- jquery ajax promise
- angular material inline list
- vendor bundle base js and bootstrap min js conflict
- javascript integer to string
- jquery remove all alerts
- javascript hasownproperty
- javascript exeit from loop
- Exception in thread "main" org.openqa.selenium.JavascriptException: cannot read getPlayerState
- get parent element using jquery
- list pci express version command line
- react native passing parameters to routes