JSFiddle - React, Tailwind, and code Playground
JavaScript
var twoDArrayGenerator,
generateTable,
ROW_MAX = 10,
COL_MAX = 3;
twoDArrayGenerator = function(){
var contentCount = 0,
i,j,
theArray=[];
for(i=0; i<ROW_MAX; i++){
theArray[i] = [];
for(j=0; j<COL_MAX; j++){
theArray[i][j] = contentCount++;
}
}
return theArray;
};
generateTable = function(theArray){
var theTable = document.createElement("table"),
i,j,
currentRow,currentCol;
for(i=0; i<ROW_MAX; i++){
currentRow = theTable.insertRow();
for(j=0; j<COL_MAX; j++){
currentCol = currentRow.insertCell();
currentCol.innerHTML = String(theArray[i][j]);
}
}
theTable.setAttribute("border","1");
document.body.appendChild(theTable);
};
generateTable(twoDArrayGenerator());