You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// if first button isn't up, return
if (keypresses.length == 0 && key != 38) {
return;
// if valid konami code character and keypresses available
} else if (keypresses.length < 10 && /37|38|39|40|65|66/.test(key)) {
Ideally rather than validating a correct konami code character, it should verify if the order of the codes is entered correctly. The way it is now, if the user hits up and then hits any key that is a valid konami character i.e. up 10 times, it will still go through and try to validate. We can optimize it by simply going through a stack of the valid keypresses and fail the whole thing if its wrong.
The text was updated successfully, but these errors were encountered:
Taking a look at the code
Ideally rather than validating a correct konami code character, it should verify if the order of the codes is entered correctly. The way it is now, if the user hits up and then hits any key that is a valid konami character i.e. up 10 times, it will still go through and try to validate. We can optimize it by simply going through a stack of the valid keypresses and fail the whole thing if its wrong.
The text was updated successfully, but these errors were encountered: