Want to convert this nested array, TableData, to a set of objects which point to the values of the first array as the key in the key/value pair. However, I keep getting the error that I can't run a function within a loop. Any thoughts on how to remedy this?
const tableData = [
  ["first_name", "last_name", "city", "state"],
  ["Elisabeth", "Gardenar", "Toledo", "OH"],
  ["Jamaal", "Du", "Sylvania", "OH"],
  ["Kathlyn", "Lavoie", "Maumee", "OH"]
  ];
  function convertTable(arr){
  let returnArr= [];
  for (let arrSpot=0; arrSpot< arr[0].length; arrSpot++){
    if (arrSpot !== 0){
      returnArr.push(
        arr[0].reduce((accum,arrItem,index)=> {
          accum[arrItem] = arr[arrSpot][index];
          return accum;
        },{})
      );
    }
  }
  console.log(returnArr);
 
    