Skip to content

Instantly share code, notes, and snippets.

@kizdolf
Last active December 9, 2017 09:25
Show Gist options
  • Save kizdolf/0da49bcf8a15eda2eac3 to your computer and use it in GitHub Desktop.
Save kizdolf/0da49bcf8a15eda2eac3 to your computer and use it in GitHub Desktop.
Konami code js, jQuery
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