Last active
December 5, 2017 13:14
-
-
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
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 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