JSFiddle - React, Tailwind, and code Playground

HTML

<div id='chess'></table>

JavaScript

function table(rows, cols) {
    var table = '<table border=10 cellspacing=0 cellpadding=0>';
    for (i = 0; i < rows; i++) {
        table += '<tr>';
        for (j = 0; j < cols; j++) {
            if (i % 2 == 0) {
                var bgcolor = (j % 2 == 0) ? '#000000' : '#FFFFFF';
            }
            else {
                var bgcolor = (j % 2 == 0) ? '#FFFFFF' : '#000000';
            }
            table += '<td bgcolor=' + bgcolor + ' width=30 height=30></td>';
        }
        table += '</tr>';
    }
    table += '</table>';
    return table;
}

$(table(8, 8)).appendTo('#chess');