[Solved] How to insert an HTML table in Javascript?


    function addMultiTable(rows, cols) {
    var myHeader = document.getElementsByTagName("h1")[0];
    var table = document.createElement("table");

        
    for(i=0; i < rows; i++ ) {
       var row = document.createElement("tr");
       table.appendChild(row);
       for (j = 0; j < cols; j++) {
        var cell = document.createElement("td");
        cell.innerHTML = (i+1)*(j+1);//value inside cells
        row.appendChild(cell);
           
       }
       table.appendChild(row);
    }
    myHeader.appendChild(table);
}

solved How to insert an HTML table in Javascript?