JSFiddle - React, Tailwind, and code Playground

by Drew Noakes

CSS

table, th, td
{
    border: 1px solid black;
}

table
{
    border-collapse: collapse;
}

JavaScript

var table = document.createElement("table");
var tableBody = document.createElement("tbody");

var row = document.createElement("tr");

for (var i = 0; i < 5; i++) {
    var cell = document.createElement("td");
    var cellText = document.createTextNode("This is cell " + i);
    cell.appendChild(cellText);
    row.appendChild(cell);
}

tableBody.appendChild(row);

table.appendChild(tableBody);

document.body.appendChild(table);