Whack-a-Mole is a fast-paced browser-based mini-game built using HTML, CSS, and JavaScript. Moles randomly pop up from holes on the screen, and the player has to click (whack) them as quickly as possible before they disappear.
This project is perfect for beginners and intermediate developers looking to understand DOM manipulation, timing functions, randomization, and basic game mechanics using web technologies. It’s a fun way to learn interactivity and animation with vanilla JS.
Responsive and interactive game layout
Randomized mole appearance using JavaScript
Score counter that updates in real-time
Game timer with auto-stop when time runs out
Clean UI and smooth animations with CSS
Sound effects support (optional)
Click the Start button to begin the game.
Moles will randomly pop up from the holes.
Click (or tap) the moles to score points before they hide again.
The game lasts for a set time (e.g., 30 seconds).
Your final score will be displayed when time is up.
You can press Restart to play again.
Use of setInterval()
and setTimeout()
for timed events
Basic collision logic with event listeners
DOM selection and dynamic styling
Creating an interactive UI with pure JavaScript
Last Update | 07 Jun, 2025 |
Created | 02 Jun, 2025 |
Technology Used | Html Css JavaScript |
Compatible With | Any Browser |
Documentation | No |
Layout | Responsive |
Total Download | 5 |
Total Views | 10 |
Tags | Whack-a-mole Game HTML CSS JavaScript Game Browser Game Vanilla Js Game Whack Mole Project Frontend Game Beginner Game Project Web Game |