Created
August 8, 2014 15:31
-
-
Save llaine/23d8a00544f7f2b15221 to your computer and use it in GitHub Desktop.
Konami code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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