JavaScript Calculator Not Passing

Hey Guys, first solo JavaScript problem I know the method could be better but I believe it should be passing the FCC test. Could anyone tell me why these aren’t being recognized as passed?

The first test you are failing is expecting 5 - 9 + 5 to display 1 and not 1.0 There is no reason for the .0 to be on the end.

The second test you are failing is because your calculator allows you to enter numbers such as 2.56.89 and it should not.

Are you reading the extra error details that show in the tests? This extra information tells you exactly what it expected and what your solution returned instead. For example, the 3rd test you are failing (Test #13) shows the following error and extra details:

  1. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered**
    **The sequence “5 * - + 5” = should produce an output of “10” : expected ‘10.0’ to equal ‘10’
1 Like

Ah I see I didn’t read the test properly. This was attempt #1 back to the drawing board. Thanks for the response