I want to be able to have an else statement that always default when I hit a key.
var key = event.key;
if(key == "ArrowDown"){
//do something
} else if(key == "ArrowUp"){
//do something
} else{
//do something
}
The problem is that the program stops and waits for event.key, so else only happens when I hit another key, I want else to happen every time through the loop without having to hit a key. I have tried var key = event.key || "asdf"
and then switching the else to else if(key == "asdf")
but I havent had any luck. This is in javascript. I am not stuck to using event.key, I am open to using something else
Aucun commentaire:
Enregistrer un commentaire