$(document).ready(function() {
  var game = new Game('0000202000000000');
  updateDOM(game);
  // debugger;


  //put game on HTML
  //bind keys
   Mousetrap.bind('up', function() {
      game.moveUp();
      updateDOM(game);

   });

   Mousetrap.bind('down', function() {
      game.moveDown();
      updateDOM(game);
   });

   Mousetrap.bind('left', function() {
      game.moveLeft();
      updateDOM(game);
   });

   Mousetrap.bind('right', function() {
      game.moveRight();
      updateDOM(game);
   });
}); //end document ready.

function updateDOM(game){
  // debugger;
  var gameArray = game.get2DArray();

  updateRow(gameArray, 0);
  updateRow(gameArray, 1);
  updateRow(gameArray, 2);
  updateRow(gameArray, 3);
}

function updateRow(gameArray, rowNum){
  var row = gameArray[rowNum];
  var tableRow = $("#r" + rowNum);
  var content = "";
  for(var i=0; i<4; i++){
    content +=("<td style='background-color:" + COLORS[row[i]] + ";'><strong>"+ row[i] +"</strong></td>");
  }
  tableRow.html(content);
}

COLORS = {0: "white",
          2: "#E8E1D2",
          4: "#E8D0A5",
          8: "#E8AA6F",
          16: "#E88A4C",
          32: "#E86550",
          64: "#E8462D",
          128: "#FFE35D",
          256: "#FFC700",
          512: "blue",
          1024: "green",
          2048: "teal"
          }
@@ -90,24 +90,8 @@
 e);%0A
-  // debugger;%0A%0A
 %0A  /
@@ -203,17 +203,16 @@
 (game);%0A
-%0A
    %7D);%0A%0A
@@ -548,23 +548,8 @@
 e)%7B%0A
-  // debugger;%0A
   va
@@ -581,17 +581,16 @@
 rray();%0A
-%0A
   update
@@ -980,19 +980,18 @@
 ntent);%0A
+
 %7D%0A
-%0A
 COLORS =

remove some unecessary lines