Welcome to the Number Guesser game! This simple JavaScript game lets you guess a random number between 0 and 9 and see if you can beat the computer.
-
Input a Number: Start by inputting a number between 0 and 9 in the input field provided for you.
-
Make a Guess: Click the "Make a Guess" button to submit your guess. The computer will also make a guess.
-
See Who Wins: The game will determine whether you or the computer is closer to the target number. If you win, you'll see a "You Win!" message; otherwise, the computer wins.
-
Next Round: Click the "Next Round" button to play another round.
- Random Target Number: A random target number between 0 and 9 is generated for each round.
- Scorekeeping: Your score and the computer's score are displayed, and they are updated after each round.
- Input Validation: The game ensures that you input a valid number between 0 and 9.
- Number Controls: You can increment or decrement your guess using the "+" and "-" buttons.
- Styling: The game has a clean and user-friendly interface with CSS styling.
You can find the JavaScript code for the game in script.js
. This code handles the game logic, including generating the target number, comparing guesses, and updating the scores.
The CSS styling for the game is defined in style.css
. It ensures that the game looks visually appealing and is easy to use.
The HTML structure for the game is defined in index.html
. It sets up the layout and elements required for the game.
To play the game, simply open index.html
in your web browser. Make sure you have an internet connection since it references external fonts via Google Fonts.
Enjoy playing the Number Guesser game and have fun guessing those numbers!