Build a JavaScript Calculator

I am not able to pass the test no. 13 of Build a JavaScript Calculator. Please somebody let me know, why I am failing the test.

Here is my link to CodePen:

sequence “5 * - + 5” = should produce an output of “10”

  • currently in your implementation only allows at most “two consecutive operators” at a time and not more than that, here it needs to be more than that

hope this was helpful, happy coding :slight_smile:

thanks for the response @bappyasif , Here I have implemented according to the test case. Suppose if I entered + as my first operator, then I can replace it by any consecutive operator enter afterwards. But if I enter first operator and again enter - (minus)as operator, then it won’t allow you to change operator from that point onwards.

Hi @bappyasif , I found the answer while replying you. I made the operator not able to change after entering (-)minus sign when there is already an operator present. I code to change that situation and let third operator replace both the first operator, second operator as minus.

thanks again!

well done :clap:

happy coding :slight_smile:

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