A simple JavaScript-based number guessing game that runs in the browser.
The user chooses a maximum number, and the program generates a random number between 1 and the chosen max.
The player then tries to guess the number using hints provided after each guess.
- The game asks the user to enter a maximum number.
- The program secretly generates a random number between
1and the entered maximum. - The user guesses the number using prompt.
- The game provides hints:
"your number is small"β Guess higher"your number is large"β Guess lower
- The player can type "quit" anytime to exit the game.
- If guessed correctly β π You Win!
| File | Description |
|---|---|
index.html |
Basic HTML file linking the JavaScript |
app.js |
Contains the game logic (JavaScript) |
This project helps you understand:
prompt()input handlingwhileloopsif/elsedecision making- Random number generation
- String comparison
- Basic game logic flow
- Download or Clone the repository:
git clone https://github.com/shanusingh01/guessing-game.git
- Open index.html in any web browser.
- Follow the prompts and try to guess the number!
- Enter the maximum number: 50
- Guess the number: 10
- Hint: your number is small, please try again!
- Guess the number: 37
- Hint: your number is large, please try again!
- Guess the number: 25
- π You win! The number is 25
- Simple and interactive
- Provides real-time hints
- Lets user exit anytime using "quit"
- Uses core JavaScript functions (no libraries required)