JSFiddle - React, Tailwind, and code Playground
by Alexis LĂłpez Espinoza
HTML
<table id="infracciones">
<thead>
<tr>
<th>Patente</th>
<th>2011</th>
<th>2012</th>
<th>2013</th>
<th>Infracciones</th>
</tr>
</thead>
<tbody>
<tr>
<td class="info">TP031</td>
<td>4</td>
<td>3</td>
<td>6</td>
<td class="total"></td>
</tr>
<tr>
<td class="info">SI0352</td>
<td>0</td>
<td>3</td>
<td>9</td>
<td class="total"></td>
</tr>
<tr>
<td class="info">MP4012</td>
<td>0</td>
<td>0</td>
<td>3</td>
<td class="total"></td>
</tr>
</tbody>
</table>
JavaScript
[].forEach.call(document.querySelectorAll("#infracciones tbody tr"), function(tr){
var suma = 0;
[].forEach.call(tr.querySelectorAll("td:not(.total):not(.info)"), function(td){
suma += parseInt(td.innerHTML);
});
tr.querySelector(".total").innerHTML = suma;
});