JavaScript Calculator keeps failing tests 13 and 14 but output is correct

According to the FCC tester I keep failing tests 13 and 14 however my calculator is returning the proper answers.

Here is the link to my project:
JS calculator

Test #14 says an input of “5 + 3 = + 3 =” should produce ‘13’. How could this be?
5 + 3 = 8 … 8 + 3 = 11? Is this a typo?

Any help would be much appreciated.

The test error message you are receiving is below:

  1. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.

I you take the following steps with your calculator, based on the test requirements, the answer should be 10 and not 25 which is what your calculator does.

1. Click `5`
2. Click `x`
3. Click `+`
4. Click `5`
5. Click `=`

It seems that once you have clicked an operator, your calculator ignores any other operator clicked instead of changing it to the last operator clicked.

2 Likes

Ahh i see i see. Thanks!

As a side note the code pen that is given as an example solution to this project doesn’t actually pass all the tests.