Just wondering what this (highlighted in bold) is supposed to be in the original code:
this.total += (itemCost || 0);
this.lastTransactionAmount = itemCost;
If I'm not mistaken, this would mean that itemCost or 0 should be added to this.total ... but that does not seem to make much sense. After all, this is a simple mathematical addition, not an if statement. Neither do we want to work with booleans here, just with numbers. So what is this supposed to be and why is it there?