Number Guessing Game Welcome to the Number Guessing Game project! This is a simple JavaScript-based game where the player has to guess a randomly generated number between 1 and 100. The player receives feedback on whether their guess is too high, too low, or correct.
Project Features Random Number Generation: A random number between 1 and 100 is generated when the game starts. User Input: The player enters their guess through an input field. Feedback: The game provides feedback about whether the guess is too high or too low, or if the player has successfully guessed the correct number. Attempts Counter: The number of attempts the player has made is tracked and displayed. Restart Option: A restart button allows the game to begin again with a new random number. How It Works Start the Game:
The game starts by generating a random number between 1 and 100 using the Math.random() function. The player makes guesses by entering numbers in the input field and pressing the "Submit" button. Feedback on Guess:
If the guess is correct, a message displays, congratulating the player. If the guess is too high, a message will say "Too high! Try again". If the guess is too low, a message will say "Too low! Try again". Attempts Counter:
Each time the player makes a guess, the number of attempts is incremented and displayed on the screen. Restart the Game:
The player can click the "Restart" button to start a new game with a new random number and reset the attempt counter.