Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Whac-a-Mole in JavaScript

Code with Ania Kubów via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn to create a simple grid-based Whac-a-mole game using HTML, CSS, and JavaScript in this 28-minute tutorial. Explore essential concepts such as document.querySelector(), textContent, forEach, addEventListener, setInterval, and classList.add while building an interactive game where players hit moles appearing on a grid before time runs out. Gain hands-on experience with DOM manipulation, event handling, and game logic implementation. Follow along to create the game's structure, style the grid, and program the core mechanics, including randomizing mole appearances, tracking player score, and implementing a countdown timer.

Syllabus

Intro
Sponsor
Overview
Grid
Styling
Logic
Document Query Selector
Random
Remove mole
Random number
Random square
Move mole
Random squares
Countdown
Adding the mole

Taught by

Code with Ania Kubów

Reviews

Start your review of Whac-a-Mole in JavaScript

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.