My code keeps running infinitely for some reason and I don't know how to fix it, can anyone help pls?
I'm trying to make a game using javascript where the user tries to guess the randomly generated number. There supposed to have infinite tries til they guess the number correctly. Every time they guess console.log will either tell them they guessed too high, low, out of range, or they won. For some reason whenever I guess with VALID NUMBERS it just keeps going infinitely and never output anything. Thanks. My code: // Sets the highest amount that the computer can randomly output let maximum = 10; // Generates a random number let randomNumber = Math.floor(Math.random() * maximum) + 1; // Stores the value if the user is still playing let stillPlaying = true; // Asks the user to guess the number while (stillPlaying) { let userGuess = prompt("Guess a whole number from 1-" + maximum + ":"); userGuess = parseInt(userGuess); if (userGuess < 1 || userGuess > maximum) { console.log("That's out of range"); } else if (userGuess === randomNumber) { console.log("You guess the number! Yipee!"); stillPlaying = false; } else if (userGuess > randomNumber) { console.log("You guessed too high!"); } else if (userGuess < randomNumber) { console.log("You guess too low"); } }