JSFiddle - React, Tailwind, and code Playground

by Graham Fairweather

CSS

table {
    width: 100px;
    height: 100px;
    border-style: solid;
    border-width: 3px;
}
td {
    width: 25px;
    height: 25px;
    border-style: solid;
    border-width: 1px;
}

JavaScript

var table = document.createElement('table'),
    tHead = document.createElement('thead'),
    tBody = document.createElement('tbody'),
    row,
    cell,
    a,
    b;

table.align = 'center';
table.appendChild(tHead);
table.appendChild(tBody);
for (a = 0; a <= 3; a += 1) {
    row = tBody.insertRow(-1);
    for (b = 0; b <= 3; b += 1) {
        cell = row.insertCell(-1);
        cell.id = (4 * a) + b;
        cell.align = 'center';
        cell.appendChild(document.createTextNode(cell.id));
    }
}

document.body.appendChild(table);