Created
August 4, 2019 10:55
-
-
Save yasaryousuf/067b34e2b86d4126de826db71eb4e1e5 to your computer and use it in GitHub Desktop.
This file contains 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
const isPrime = num => { | |
let sqrt = Math.sqrt(num); | |
for(let i = 2; i <= sqrt; i++) { | |
if(num % i === 0){ | |
return false; | |
} | |
} | |
return true; | |
} | |
console.log(isPrime(5)); |
yukulele
commented
Jul 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment