Two versions of the same game — one from a tutorial, one extended with my own ideas.
guess-my-number/
├── original/
│ ├── index.html
│ ├── style.css
│ └── script.js
│
├── upgraded/
│ ├── index.html
│ ├── css/
│ │ └── style.css
│ ├── script.js
│ └── sounds/
│ ├── START.mp3
│ ├── WIN.mp3
│ ├── ERROR.mp3
│ └── OVER.mp3
│
└── README.md
Built while following Jonas Schmedtmann's JavaScript course. This is the foundation.
- Open the
original/folder - Double-click
index.html - The browser opens — start guessing
Or use Live Server in VS Code.
- Guess a number between 1 and 20
- Score starts at 20, decreases with each wrong guess
- Highscore tracks best performance per session
- Win: green background
- Lose: red background
Same core game, but with a new interface and extra features I added after learning the fundamentals.
- Open the
upgraded/folder - Double-click
index.html - Ensure sound files are in
upgraded/sounds/
Audio files must be present with exact names:
| File | Purpose |
|---|---|
START.mp3 |
Plays on page load and reset |
WIN.mp3 |
Plays on correct guess |
ERROR.mp3 |
Plays on wrong guess |
OVER.mp3 |
Plays on game over |
| Feature | Description |
|---|---|
| Number grid | Visual 1–20 layout instead of typing |
| Mobile tap | Tap cells directly on phones and tablets |
| Sound design | Audio feedback for all game events |
| Loading lock | Input disabled during start sound |
| Win/lose themes | Full-page color changes with matching borders |
| Already tried | Re-guessing same number counts as attempt |
- Game selects a random number between 1 and 20
- Click or tap grid cells to guess
- Wrong guess: cell turns blue (too high) or orange (too low)
- Score decreases by 1 for each wrong guess
- Score reaches 1 and you guess wrong again = game over
- Correct guess: cell turns green, badge reveals the number
| If you want to see... | Open |
|---|---|
| Tutorial code I learned from | original/ |
| What I built after understanding the concepts | upgraded/ |
| Clean, simple DOM manipulation | original/ |
| Event delegation and dynamic elements | upgraded/ |
| Mobile-first design approach | upgraded/ |
- HTML5
- CSS3 (Flexbox, Custom Properties)
- Vanilla JavaScript (ES6+)
- Web Audio API
No frameworks. No build tools.
- DOM selection and manipulation
- Click event handling
- Game state management
- CSS updates via JavaScript
- Dynamic element creation with loops
- Event delegation for grid clicks
- Media query matching in JavaScript
- Audio playback with Promise handling
- Disabled state management during async operations
- Mobile and tablet responsive design
Tutorials are starting points. This is what happened when I kept going.