JSFiddle - React, Tailwind, and code Playground

HTML

<table class="table table-responsive table-hover table-striped" id="tableNSerie" style="font-size:12px;">
                                            <thead>
                                                <tr>
                                                    <th>Código</th>
                                                    <th>Produto</th>
                                                    <th>Nº Série</th>
                                                </tr>
                                            </thead>
                                            <tbody><tr><td>P00002</td><td>INNER REP PLUS LC BIO PROX</td><td></td></tr></tbody>
                                        </table>
                                    <button id=button>
                                    teste
                                    </button>

JavaScript

$('#button').on('click', function (e) {
    var trs = document.getElementById('tableNSerie');
    var tr = trs.getElementsByTagName("tr");
    var todos = null;
    var td;
    console.log(trs);
    console.log(tr);
    for (i = 0; i < tr.length; i++) {
        td = tr[i].getElementsByTagName("td")[2];

        if ($(td).text() === "") {
            todos++;
            alert(todos);
        }
    }
})