Created
March 23, 2016 02:38
-
-
Save mindplace/fe99dfa9f13feb56c012 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
| function primeTester(num) { | |
| var range = new Array; | |
| for (var i=1; i <= num; i++) { | |
| range.push(i); | |
| } | |
| var factors = new Array; | |
| for (var i=0; i < range.length; i++) { | |
| var current = range[i]; | |
| if (num % current === 0) { | |
| factors.push(current); | |
| } | |
| } | |
| if (factors.length === 2) { | |
| return true; | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment