I have Javascript code as follows:
addEventListener("keydown", function (e) {
keysDown[e.keyCode] = true;
}, false);
addEventListener("keyup", function (e) {
delete keysDown[e.keyCode];
}, false);
if (81 in keysDown){
doThisFunction() //q
}
doThisFunction will be called when I press the q button on the keyboard. I found the line "81 in keysDown" to be quite interesting.
I was wondering if there was a way to say "if 81 is NOT in keysDown" so that I can detect a moment when q has been let go or when q is not pressed.
Thanks in advance!