Created
April 6, 2016 11:20
-
-
Save liesislukas/6d123fdc0a757f11219399c5426aa4b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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