Skip to content

Instantly share code, notes, and snippets.

@llaine
Created August 8, 2014 15:31
Show Gist options
  • Save llaine/23d8a00544f7f2b15221 to your computer and use it in GitHub Desktop.
Save llaine/23d8a00544f7f2b15221 to your computer and use it in GitHub Desktop.
Konami code
var input = "";
var konamiLetters = "72726666716871686665";
var konamiArrow = "38384040373937396665";
document.onkeydown = function(evt){
evt = evt || window.event;
input += evt.keyCode;
};
var timer = setInterval(function(){
if(input !== null || input !== undefined){
if(input === konamiLetters || input === konamiArrow){
console.log('You win ! :) Well done for trying ;)');
clearInterval(timer);
return true;
}
}
}, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment