Created
May 11, 2015 19:32
-
-
Save brookr/9e363b18a925ba1168ba to your computer and use it in GitHub Desktop.
Example JS game
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"> | |
var guess, answer, message; | |
answer = Math.floor(Math.random() * 100) + 1; | |
console.log(answer); | |
guess = prompt("What do you choose? 1-100?"); | |
if (guess == answer) { | |
message = "Good guess, you're right!"; | |
} else { | |
message = "Good guess, but YOU ARE WRONG." | |
} | |
alert(message); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment