I almost completed the calculator project and only one test is remaining before I can get the front end certificate. The test follows:
13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.
I understand the user requirement and have tried to build a feature so that when I enter
5 * - + 5 , it will return
10. However, this will means that I won’t be able to perform
5 * - 5 = -25. And if I remove
class="operator" from the subtract element, I will be able to enter
5 * - 5 = -25 but the
5 * - + 5 = 10 will fail. And if I restore the class operator to the subtract, I can do
10 but again
-25 will fail.
How am I suppose to solve this issue?