Skip to content

Instantly share code, notes, and snippets.

@ian-lowe
Created February 8, 2018 20:10
Show Gist options
  • Save ian-lowe/759cef2ebfb864826da004176ab2e7f2 to your computer and use it in GitHub Desktop.
Save ian-lowe/759cef2ebfb864826da004176ab2e7f2 to your computer and use it in GitHub Desktop.
var key = 5;
while (Number(guess) !== secretNumber) {
var guess = prompt("Guess a number");
if (Number(guess) < secretNumber) {
alert("You guessed low. Please guess again!");
}
else if (Number(guess) > secretNumber) {
alert("You guessed high. Please guess again!");
}
else {
prompt("You guessed the number correctly!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment