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

YouTube

Build Minesweeper with JavaScript

Traversy Media via YouTube

Overview

Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This course builds Minesweeper with vanilla JavaScript, using DOM event listeners, dynamically created grid cells, and recursion to reveal neighboring squares. It also implements flags and win detection.

Syllabus

- Brad's Intro.
- Ania's Intro.
- Recursion explainer.
- Setting up our HTML.
- Styling our Grid in CSS.
- Setting up our JavaScript usng the DOM EventListener.
- Creating our Board using .createElement() and .appendChild().
- Adding numbers to the board using Modulus and .contains().
- Checking what is under a Square usng .getAttribute() .innerHTML and .add().
- Checking neighbouring squares using recursion and setTimeout.
- Adding flags to squares with a left click.
- Checking for wins.

Taught by

Traversy Media

Reviews

Start your review of Build Minesweeper with 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.