DEV Community

Ania Kubow
Ania Kubow

Posted on

6 1

Whac-a-mole in JavaScript (super simple)

This video is Sponsored by HarperDB. Sign up free through the HarperDB Studio: http://bit.ly/HarperDBAniaKubow.

Learn to make a simple grid-based game using HTML, CSS and JavaScript. The idea of whack-a-mole is simple! The player needs to hit the grid with the mole in as many times as possible until the time runs out. In this tutorial, we will cover:

  • document.querySelector()
  • textContent
  • forEach
  • addEventListener
  • setInterval
  • classList.add

...and many more.

As always, if you get stuck or have any questions, please do comment below and I will be sure to get back to you!

Please don't forget to Subscribe and hit that bell button! it would really mean a lot to me and inspire me to make more content for you all! :)


In most videos I use Tabnine as my A.I autocompletion tool. You can download it for free here: http://bit.ly/tabnine-top-tool

If you would like to buy me a coffee, well thank you very much that is mega kind! : https://www.buymeacoffee.com/aniakubow

Sign up for weekly coding tips from my newsletter partnership: https://bit.ly/JS-tips

GitHib Code here: https://github.com/kubowania/whack-a-mole

You can also find me on:
Twitter: https://twitter.com/ania_kubow
Instagram: https://www.instagram.com/aniakubow

codingbootcamp​​ #coding

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay