Skip to content

Instantly share code, notes, and snippets.

@brookr
Created May 11, 2015 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brookr/9e363b18a925ba1168ba to your computer and use it in GitHub Desktop.
Save brookr/9e363b18a925ba1168ba to your computer and use it in GitHub Desktop.
Example JS game
<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