JSFiddle - React, Tailwind, and code Playground

HTML

<table id ="testtable">
    <tbody>
        <tr data-record-key="0"> 
            <td>ALL</td>
        </tr>
        <tr data-record-key="1"> 
            <td>ONE</td>
        </tr>
    </tbody>
</table>

JavaScript

var recordKeys = $('[data-record-key]').map(function() {
    return $(this).data('recordKey');
}).get();

console.log(recordKeys); // outputs: [0, 1]
alert(recordKeys);