Last active
December 9, 2017 09:25
-
-
Save kizdolf/0da49bcf8a15eda2eac3 to your computer and use it in GitHub Desktop.
Konami code js, jQuery
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 winner = ()=>{/*do what ever you want*/}; | |
var konami = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65], | |
i = 0, | |
l = konami.length - 1; | |
(document).keyup(function(e){ | |
i = (konami[i] == e.keyCode) ? ((i == l) ? 0 && winner() : i + 1) : 0; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment