Cannot debug test case number 13 for my JavaScript Calculator


I have completed the JavaScript calculator, but it seems that I am not able to complete the test case number 13. I have followed the given calculator as a model.

Here is a link to my pen:

Can someone please help me out with the same?

Hi, i check out your code and it seems the only test you are not passing is

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

You will need to use something like regular expressions to check for when 2 or more operators follow each other consecutively then extract them and leave the last when equals button is pressed except its a minus sign. Let me know if you understand or don’t.


I did follow the same logic. Even the solution from freeCodeCamp shows the same logic, but I am not able to complete the implementation.

You will need to emphasize more on “not able to complete”. What challenges are you facing now ?? Have you implement your regex matches ?