In the previous lecture, you could briefly see a newTotalPrice for the cart of -3.55271... (at 10:10).

What's this about?

The actual number was a pretty small number as it was -3.55271...*e-10 (i.e. it was a very, very small number, expressed as <some number> x e^-10).

Where does this small number come from though? 59.99 - 59.99 should yield zero, not a super small number, right?

The problem is, that computers aren't that great when it comes to doing math with fractional numbers (i.e. non-integer numbers => number that have decimal places).

If you want to dive into the theory behind this "error", you can explore blog posts like this one: https://modernweb.com/what-every-javascript-developer-should-know-about-floating-points/

In your daily work, the more important takeaway is to understand how to work around such issues. And that is pretty simple: If you want to output a value and avoid this small precision error (in the output), you can achieve this by calling toFixed(<number of decimal places>) on the number.

E.g. 5.121321.toFixed(2) yields 5.12 => The other decimal places are simply cut off.