try to return the string using template literals so that whatToDelete is passed as a variable:
return `<i class='fas fa-trash-alt text-danger' onclick="deleteRecord(this.closest('tr'),${whatToDelete});"></i>`;
And like other people mentioned, try to avoid this sort of stuff
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…