any javascript soldiers know how to put an onevent style input into an if statement? like if input = rightArrow ty shii

comments (single view)

// code by the code witch lily :3

var keys = {};

document.addEventListener("keydown", (event) => {keys[key] = true});
document.addEventListener("keyup", (event) => {keys[key] = false});

function tick() {
  if (keys["e"]) alert("haii world! :3");
}
View all comments