The Konami Code Challenge 🐙
Hi, *|USERNAME|*!
I'm going to sound like a broken record by saying this, but one of the best ways to learn JavaScript is to just build something (and many somethings). In that line of thought, there is a new (and fun!) challenge on the site that will test your understanding of various JS concepts. It has to do with you implementing the Konami Code.
In case you aren't familiar, the Konami Code is a classic video game cheat code whose sequence of key presses looks as follows:
When this code is entered in various popular and classic games, some game mechanic that makes the game easier will get enabled.
For what we are going to do, entering this code will display an alert with some text. Nothing fancy there. There are many ways to implement this functionality, and that is what makes this challenge a good one to use to test your understanding of arrays, timers, keyboard events, and more. Even if you don't know much about all of those topics, trying to build this example will give you a great crash-course in figuring them all out.
As with previous challenges on the site, the goal is to have you try to solve it on your own. If you get stuck or need some inspiration, one possible solution that I came up with is posted and explained towards the end. If you have a more clever solution, I encourage you to share it with others on this thread. If you have any questions, you should post there as well to get a quick answer.
UNTIL NEXT TIME!
As always, before I leave you to it, I would love to hear from you on things I can do better, topics you'd like me to write about, and more. Don't be shy! The easiest way to contact me is via Twitter or by posting on the forums...just like the good old phpBB days!
Cheers,
Kirupa 😛