A simple and interactive number guessing game built using HTML and JavaScript. The player has to guess a randomly generated number between 1 and 10.
This is a beginner-friendly web project where:
- A random number is generated between 1โ10
- The user inputs a number
- The system checks whether the guess is correct or not
- The score decreases for every wrong attempt
- ๐ข Random number generation (1โ10)
- ๐ฏ User input validation
- ๐ Score tracking system
- โ Wrong guess feedback
- ๐ Winning alert message
- HTML5
- JavaScript (Vanilla JS)
Guess-The-Number/
โโโ index.html # Main game file
- Download or clone the repository
- Open the
index.htmlfile in any web browser - Enter a number between 1 and 10
- Click Check to see the result
-
The game generates a random number using:
Math.floor(Math.random() * 10 + 1)
-
Player starts with a score of 10
-
Each wrong guess reduces the score by 1
-
Game continues until the correct number is guessed
- Input a number โ Click Check
- If correct โ ๐ "You are Right!"
- If wrong โ โ Score decreases
- Add restart/reset button
- Limit number of attempts
- Provide hints (higher/lower)
- Improve UI with CSS styling