JSFiddle - React, Tailwind, and code Playground

HTML

<table></table>

CSS

td { width:20px; height:20px; border:1px solid grey; }
.x { background-color: #aaa }

JavaScript

for (i=0; i<=5; i++) {
    $('table').append('<tr>');
    
    for (j=0; j<=5; j++)
        ((i == j)||(1 == 2)) ?
            $('tr:last').append('<td class="x"></td>') : 
                $('tr:last').append('<td></td>');
    
    $('table').append('</tr>'); 
}