I am getting an error for the following code.
function getDelAction(whatToDelete){
    return "<i class='fas fa-trash-alt text-danger' onclick=\"deleteRecord(this.closest('tr'), whatToDelete);\"></i>";
}
Created a function that returns a string representation of an element. When I run the code and click on the icon, JS complains about the whatToDelete argument I am passing to deleteRecord function which the function getDelAction is accepting as parameter. If I create the same variable outside the function and pass it like this it works. What is the problem?
Calling the function like getDelAction("customer");
Thanks!
 
    