Removing purchases in a shopping calculator in JavaScript

Let's now implement removing a purchase. We already have a remove link, we create it with this line:

createCell(tr, 'remove', 'remove');

I remind you that the createCell function returns the created cell. This means that various operations can be performed with this cell. For example, let's bind a click handler to it:

let remove = createCell(tr, 'remove', 'remove'); remove.addEventListener('click', function() { // let's remove a table row });

Intermediate variable can be omitted:

createCell(tr, 'remove', 'remove').addEventListener('click', function() { // let's remove a table row });

Write the missing code to remove a table row.

Add a recountTotal function invocation at the right place so that removing the purchase updates the total sum.