Skip to content

Instantly share code, notes, and snippets.

@jmarreros
Last active December 5, 2017 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmarreros/f028263c5bd1aa43bcd9f35536f0395c to your computer and use it in GitHub Desktop.
Save jmarreros/f028263c5bd1aa43bcd9f35536f0395c to your computer and use it in GitHub Desktop.
Código Konami personalizado usando javascript, secuencia de caracteres tipeadas por el usuario para reproducir determinada acción
var pressed = [];
var secretcode = 'navidad';
window.addEventListener('keyup', function (e) {
pressed.push(e.key);
pressed.splice(-secretcode.length -1, pressed.length - secretcode.length);
if (pressed.join('') == secretcode) {
console.log('Se usó el código secreto :)');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment