New programmer here - I am trying to create a number guessing game. If I guess too high, it tells me "Too high, guess again." If I guess too low, it tells me "Too low, guess again." If I guess correct it tells me correct. But I can only guess 1 wrong answer in each direction. I have searched and searched and tried almost everything (if/else/while)
I know this is probably a simple fix for experienced programmers. Please help. Thanks ---
var secretNumber = 53;
var guess = prompt('Guess a number');
if (guess == (53)) {
alert("Yes you got it! 53 is the right answer!")}
while (guess < (53)) {
var guess = prompt('Too Low, Guess again');
}
while (guess > (53)) {
var guess = prompt('Too High, Guess again');
}
Aucun commentaire:
Enregistrer un commentaire