Cash Register Javascript project

I’ve just finished the cash register project. I completed it using a lot of if else statements and if statements. I’m just looking to see if there is a more concise way of doing it.

I also had trouble with adding the penny values together where for one of the test it was giving me a penny value of 0.5000000002 or similar. To get around this i used the “toFixed(2)” but this didnt work as it left it at 0.50 and the answer was looking for 0.5. Fortunately it passed the test without this “toFixed(2)” method being applied but i was just curious as to how you could combat this.


Personally, I track a integer number of cents instead of a decimal number of dollars.

Ah yeah makes sense, thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.