JSFiddle - React, Tailwind, and code Playground

HTML

<table id="a">
    <thead>
        <tr><td>a</td></tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <table id="b">
                    <thead>
                        <tr><td>b</td></tr>
                    </thead>
                    <tbody>
                        <tr><td>c</td></tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>

JavaScript

alert(document.querySelector("#b").querySelectorAll("tbody tr").length);