Javascript Calculator Decimal Test Cases

I feel that I should be passing test cases 11 and 12. My project is linked here.

For test case 11:
An input of “5 . 5 . 5” should display 5.55 : expected ‘555’ to equal ‘5.55’
5.5.5 does display 5.55. But what does expected 555 to equal 5.55? What does that mean?

For test case 12:
The expression “10.5 - 5.5” should produce an output of “5” : expected ‘99.5’ to equal ‘5’
10.5 - 5.5 does produce 5. But what does 99.5 equal 5 mean? What does that mean?

Someone please enlighten me.

1 Like

expected is the result the test gets from your calculator, equal is what it needs to get for the test to pass.

1 Like

fyi, try entering 10.5 in your calculator and see what you get

If I type 10.5 and press equal I get 10.5 in the console…:thinking:

haven’t looked at your code , will look at it later if you haven’t solved it by then. Playin’ around with the calc however I see an issue: On a full browser refresh of the app I can enter 10.5, however, I can break that if I enter .2 (not 0.2 but the decimal and then 2), from that point on I can not enter 10.5, if I try to I get 105 , hence why it reports to the test 99.5 (105 - 5.5), which tells me 2 things, a) you have not accounted for a user entering a decimal number without preceding it with a 0 and b) your AC button does not clear out the entire state of the calculator.

1 Like

Thanks. I think I might have fixed it. In the condition where button was clear, I forgot to reset the isCurrentDecimal state variable.