Skip to content

Instantly share code, notes, and snippets.

@juanigallo
Created September 8, 2017 19:53
Show Gist options
  • Save juanigallo/0608f5879f84f976901a15c9bdfbe8b5 to your computer and use it in GitHub Desktop.
Save juanigallo/0608f5879f84f976901a15c9bdfbe8b5 to your computer and use it in GitHub Desktop.
Find if a number is prime or not. Javascript implementation
function isPrime(value) {
for(var i = 2; i < value; i++) {
if(value % i === 0) {
return false;
}
}
return value > 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment