in the code below i'm trying to get it to log "success" into the console when I press the "w" button, but for some reason it's not doing anything when I press it. can someone tell me what I'm doing wrong?
var keysDown = {};
var keysUp = {};
window.addEventListener('keydown', function(e) {
keysDown[e.keyCode] = true;
});
window.addEventListener('keyup', function(e) {
delete keysDown[e.keyCode];
keysUp[e.keyCode] = true;
});
if (37 in keysDown || 65 in keysDown) { //left
console.log("success");
}