Building real-world projects is one of the best ways to learn to code. And if you are going to build a project, you might as well make it one of the most popular and most fun games of all time: Tetris.

Some reading music. ?

This video course from Ania Kubow will help you learn the basics of JavaScript by coding a Tetris game from scratch. This is a great course for people who have never touched code before or people who want to review the fundamentals.

The course doesn't cover every little detail of JavaScript – but that's the point. It helps you jump right in to building an actual game that you will be able to play.

You will first learn how to set up a project from scratch using the Atom code editor and a command prompt tool. Then you will gain a fundamental understanding of JavaScript by building your very own version of Tetris. Along the way, you will also get a brief overview of how to use HTML and CSS.

Throughout the course, there are explainer sections that teach basic JavaScript concepts such as variables, functions, arrays, and more. These explainer sections take a break from the Tetris project to drill down on a specific concept. They include images and diagrams to help you understand the concepts better.

Also, at the end of some sections, there are multiple-choice questions to help you test your knowledge.

tetris

Here are some of the JavaScript methods you will learn in this course:

  • addEventListener()
  • querySelector()
  • querySelectorAll()
  • keyCode()
  • Math.floor()
  • Math.random()
  • length
  • forEach()
  • splice()
  • clearInterval()
  • setInterval()
  • some()
  • innerHTML()
  • every()
  • add()
  • remove()
  • contains()

Once you finish the course, you will have created your very own Tetris game that you can play. Just be careful where you play it because the Guinness World Record for "Longest prison sentence for playing a video game" involved a game of Tetris.

You can watch the course below or on the freeCodeCamp.org YouTube channel (1.5 hour watch).