JSFiddle - React, Tailwind, and code Playground
HTML
<table id="tbPermission">
<tr>
<th>User ID</th>
<th>User Name</th>
</tr>
<tr>
<td>1</td>
<td>Test1</td>
</tr>
</table>
JavaScript
var trArray = [];
$('#tbPermission tr').each(function () {
var tr =$(this).text();
var tdArray = [];
$(this).find('td').each(function () {
var td = $(this).text();
// I want to create the array of objects here …
var items = {};
items[tr] = td;
tdArray.push(items);
});
});