Array to Grid using a table
Despite already having accepted an answer, I'd like to point out a different way to approach this. 

Since you are building the board with JavaScript I'm assuming that you want to modify the content of the board dynamically. (If not then the question would be why you are using JavaScript and not a server-side generation).

In that case it could make sense to separate generation and filling the board. That way you could simply exchange each method without affecting the other. 

For generation you could continue to use your solution just with empty or default values, or use DOM generation:

var rowCount = 6;
var colCount = 10;
var board = document.createElement('table');
for (var r = 0; r &lt; rowCount; r++) {
  var row = board.insertRow();
  for (var c = 0; c &lt; colCount; c++) {
    row.insertCell();
  }
}


Or simply use static HTML.

And then you write a function that sets the value of a cell which will work no matter how you created the board. Something like:

function setBoardValue(board, x, y, value) {
   board.rows(y).cells(x).innerHTML = value;
}


And then you can loop over your "map" in anyway you like and call it:

var map="005000200000000008000600000006000700000040000000500030400000".split("");

for (var i=0;i&lt;len;i++){
  setBoardValue(board, i % colCount, Math.floor(i / rowCount), map[i] != 0 ? map[i] : "&amp;nbsp;");
}


In the end this solution if technically slower that your solution, but usually not in an amount that would be noticeable by the user and you have an advantage with the separation of the concerns.