I would like to be able to log the key presses on a specific page, trying to implement an \'Easter egg\' type functionality where when the correct keys are pressed in the co
This maybe?
var seq = "rainbow" var input = "" window.addEventListener("keypress", function(e) { input += String.fromCharCode(e.keyCode) for (var i = 0; i < seq.length; i++) { if (input[i] != seq[i] && input[i] != undefined) { input = "" } } if (input == seq) { alert("EASTER EGG!") input = "" } })