JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
        <th> Header1 </th>
        <th> Header2 </th>
        <th> Header3 </th>
    </tr>
    <tr>
        <td> Value 1,1 </td>
        <td> Value 2,1 </td>
        <td> Value 3,1 </td>
    </tr>
    <tr>
        <td> Value 1,2 </td>
        <td> Value 2,2 </td>
        <td> Value 3,2 </td>
    </tr>
</table>

JavaScript

var header = Array();
    
$("table tr th").each(function(i, v){
        header[i] = $(this).text();
})
               
alert(header);

var data = Array();
    
$("table tr").each(function(i, v){
    data[i] = Array();
    $(this).children('td').each(function(ii, vv){
        data[i][ii] = $(this).text();
    }); 
})

alert(data);