Whac-a-mole in JavaScript (super simple)

Ania Kubow - Apr 14 '21 - - Dev Community

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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .