Skip to content

Instantly share code, notes, and snippets.

@liesislukas
Created April 6, 2016 11:20
Show Gist options
  • Save liesislukas/6d123fdc0a757f11219399c5426aa4b2 to your computer and use it in GitHub Desktop.
Save liesislukas/6d123fdc0a757f11219399c5426aa4b2 to your computer and use it in GitHub Desktop.
let isPrime = (num) =>{
let divisor = 2;
while(divisor < num){
if(num % divisor === 0 ){
return false;
}
divisor++;
}
return true;
}
let numbers = [1,2,3,4,5,6,7,8,9,10,11,12,13,14];
numbers.forEach((n) => {console.log(`${n} is prime: ${isPrime(n)}`); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment