constextractData=(tableId, mapper)=>{const myTab = document.getElementById(tableId);if(myTab){const data =[...myTab.rows].map((r)=>[...r.cells].map((c)=> c.innerText));return data.map(mapper);}};// Call the function and do whatever you want with the dataconst data =extractData('target-table',(x)=>({name: x[0]}));