Skip to content
Advertisement

How to add konami code in a website based on html?

I was asked to implement the Konami Code in a website I’m currently working on. It should do the following:

  1. Change Background Image

  2. Play sound

  3. Bring some pop-up

What’s the easiest way to achieve this using javascript?

Advertisement

Answer

Place the code below in a file js/konami.js and reference it in the body of your html file like this: <script src="js/konami.js"></script>

JavaScript

EDIT: changed the sequence to b, a instead of a, b. Thanks for the comment!

EDIT 2: reset the konamiCodePosition to 0 after activateCheats was called. Thanks for the comment!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement