Javascript calculator 15/16

Hello everyone. I created a a javascript calculator (from a video) and changed most of the parameters to get the tests passing. However now I am 15/16 and the only test that won’t pass is
" 13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign."
I’ve been toying around with it for the past day or so, but I’ve been stumped and need a second opinion.
Thank you in advance. Here’s my project
https://codepen.io/Dylanbozarth/pen/vYYKVNX

You are keeping track of the previous operand, but that doesn’t help you to figure out if an operator was pressed multiple times in a row.

One solution is to keep track of how many times an operator has been pressed, clearing all values when a non-operator is pressed.

Another solution is to keep track of the last key that was pressed (not just operand), and compare against that when an operator is pressed.

I prefer the latter option.

I get what you’re saying. How would you do that in JS?
I know what you’re saying in theory, but in practice I am not sure how to do it.

You already do it with the previousOperand property. You can use that as a basis on which to add a separate previousKey property too.

So here’s what I did, unfortunately it’s not working. I feel like I am close

case 'previousOperand' === '*': 
        computation = prev
        break
        case 'previousOperand' === '+': 
        computation = prev
        break
        case 'previousOperand' === '/': 
        computation = prev

Bump, I am in the last stretch and stuck

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

Yes I know it’s the last test I cannot pass.

One last bump.
I have been passing the time on codewars, so it’s not that bad. But I am still completely stumped on how to solve the last test on this.
I’m stupid, please help.

So I’ve been stumped for 6 days so far and I know exactly what I need to do, however I don’t know how to do it.
5 * -5 should equal -25
But it equals 25
I am on the last stretch here.

I was having a lot of trouble with this last test also. I didn’t look at your code, but testing out your calculator you aren’t allowing multiple operations to be inputted (the same problem I was having). You have to let the calculator input as many operations as it wants and then clean up the input after = is pressed instead of limiting what can be inputted because you don’t know what to evaluate until all the operations have been inputted. Also, the test AFTER 5 *- 5 = -25 is 5 *-+ 5 = 10. It took me a bit of spaghetti code to figure out lol…