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
<script type="text/javascript"> | |
// Declare variables | |
var userGuess, userChoice, answer; | |
// Present user with two options | |
do { | |
userChoice = prompt('Would you like to choose your own number, or have the computer randomly choose for you? \ | |
1: Choose \ | |
2: Random'); | |
} while (userChoice != '1' && userChoice != '2'); |
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
<html> | |
<script> | |
var guess; | |
var prime = 2; | |
var isPrime = function(prime) { | |
for (var count = 2; count < prime; count++){ | |
if (prime % count == 0){ | |
return false; |