Years some simple code that you can use to make or build your own car racing game.

Just copy them and paste into editor. Remember this quotes will not work in every single part from. 

<!DOCTYPE html>
<html>
<head>
  <style>
    #canvas {
      border: 1px solid black;
    }
  </style>
</head>
<body>
  <canvas id="canvas" width="500" height="300"></canvas>
  <script>
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");
    var x = 10;
    var y = 10;
    var width = 50;
    var height = 50;

    function draw() {
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      ctx.fillStyle = "red";
      ctx.fillRect(x, y, width, height);
    }
    draw();

    document.onkeydown = function(e) {
      switch (e.keyCode) {
        case 37:
          x -= 10;
          break;
        case 38:
          y -= 10;
          break;
        case 39:
          x += 10;
          break;
        case 40:
          y += 10;
          break;
      }
      draw();
    }
  </script>
</body>
</html>