Hey all - I am having a heck of a time trying to get the user story No. 13 to pass. I’ve been doing a ton of googling - I understand the issue, but not how to solve it (If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.) If anyone has any clarity or a push in the right direction, I’d love some assistance! Here is the link to the code: https://codepen.io/Ashley_Hart/pen/xxxWPXZ?editors=0010
I had the same issue, save the operator in a state and update it if another operator pressed consecutively.
# 2 # + // Save the + in somewhere # - // update it to - # * // Update it to * # 5 # = // Now calculate based on the last update which is * # 10
@ulugbek - Thanks for the response. I have the value declared in state as ‘null’, I assume I will need to right several if/else statements to accomplish it? I’ll attempt to work it into my code now…