JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<table border="1">
    <thead>
        <tr>
            <th rowspan="3">Lorem</th>
            <th rowspan="3">ipsum</th>
            <th rowspan="3">dolor</th>
            <th colspan="4">sit</th>
            <th colspan="4">amet</th>
        </tr>
        <tr>
            <th colspan="3">consectetur</th>
            <th rowspan="2">adipisicing</th>
            <th rowspan="2">elit</th>
            <th rowspan="2">sed</th>
            <th rowspan="2">do</th>
            <th rowspan="2">eiusmod</th>
        </tr>
        <tr>
            <th>tempor</th>
            <th>incididunt</th>
            <th>ut</th>
        </tr>
    </thead>
    <tbody></tbody>
</table>

JavaScript

$(function(){
  var max = 0;
  $('tr').each(function(){
	  var current = 0;
  	$(this).find('th').each(function(){
    	var colspan = $(this).attr('colspan');
      current += Number(colspan ? colspan : 1);
    });
    max = Math.max(current, max);
  });
	console.log(max);
});