Created
August 8, 2021 22:03
-
-
Save mesalilac/6f7112d095d09d707dab8d2a70b1f38e to your computer and use it in GitHub Desktop.
is prime number
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
| function isPrime(num) { | |
| var prime = num != 1; | |
| for(var i=2; i<num; i++) { | |
| if(num % i == 0) { | |
| prime = false; | |
| break; | |
| } | |
| } | |
| return prime; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment