js/script.js
//Handles key presses and update screen.
Handles key presses and update screen.
Handles key presses and update screen .
function update(e) {
    if (e.keyCode == 37 && direction != 'right') direction = 'left';
    if (e.keyCode == 38 && direction != 'down') direction = 'up';
    if (e.keyCode == 39 && direction != 'left') direction = 'right';
    if (e.keyCode == 40 && direction != 'up') direction = 'down';
}
function update ( e ) { if ( e . keyCode == 37 && direction != 'right' ) direction = 'left' ; if ( e . keyCode == 38 && direction != 'down' ) direction = 'up' ; if ( e . keyCode == 39 && direction != 'left' ) direction = 'right' ; if ( e . keyCode == 40 && direction != 'up' ) direction = 'down' ; }
Handles key presses and update screen.
Handles key presses and update screen .