Skip to content

Instantly share code, notes, and snippets.

@carjug
Created February 6, 2015 03:24
Show Gist options
  • Save carjug/ab39bb9e94d87147c513 to your computer and use it in GitHub Desktop.
Save carjug/ab39bb9e94d87147c513 to your computer and use it in GitHub Desktop.
<script>
var guess, answer, message;
answer = Math.floor(Math.random() * 10);
while (guess != answer) {
guess = prompt("How many cats does the old lady own?");
if (guess == answer) {
message = "She has exactly " + guess + " cats!"
}
else {
message = "Wrong, guess again!"
};
alert(message);
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment