I need help with keydown and keyup events

Ah I changed it now. To be honest I had trouble understanding the tutorial in the link you sent me so I used another guide to help me.

Var time;
//ANIMATION SPEED
setTimeout(function() {
        requestAnimationFrame(draw);
       
    }, 1000 / fps);
    
    var now = new Date().getTime(),
        dt = now - (time || now);
 
    time = now;
function moveRight() {  
xpos+=moveSpeed*dt;
}

I do all my coding on my phone so I can’t test out keyboard inputs. My brother isn’t home right now so I can’t use his laptop. Do you see any problems with my code?