JSFiddle - React, Tailwind, and code Playground

HTML

<table border=1></table>
<button>hi</button>

JavaScript

max = 2

$("button").click(function() {
    var tr = $("table tr:last");
	if(!tr.length || tr.find("td").length >= max)
    	$("table").append("<tr>");
    $("table tr:last").append("<td>hi</td>");
});