Front End Calculator Project Please Help

Hi I am REALLY struggling here! I am passing all the test but one:

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

here is my code for the operations:

  const {displayValue, operator, value} = this.state
  const nextValue = parseFloat(displayValue)
  const operations = {
    "/": (prevValue, nextValue) => prevValue / nextValue,
    "*": (prevValue, nextValue) => prevValue * nextValue,
    "+": (prevValue, nextValue) => prevValue + nextValue,
    "-": (prevValue, nextValue) => prevValue - nextValue,
    "=": (prevValue, nextValue) => nextValue 
  if(value == null){
      value: nextValue
  } else if (operator){
    const currentValue = value || 0
    const computedValue = operations[operator](currentValue, nextValue)
      value: computedValue,
      displayValue: String(computedValue)
    waitingForOperand: true,
    operator: nextOperator

I feel like there is probably a pretty straight forward if/then statement I can put in to fix this but I cant figure it out for the life of me! I am a novice so any help would be greatly appreciated!!

It would help if you could provide a link to a codepen project or something like that.

Not sure if the instructions are clear for you, but they are asking to use the last operator used for the calculation. So if you press 6*+, it should use the + and ignore the *.

Yea, I feel like I need to see more code to be able to help more specifically. But when an operator is entered, check if the last one is a +, *, or / and remove it from the string or something like that.

Thanks a bunch for taking the time to look and to respond! I really appreciate it! I have been working on this project for a good little while. I have followed along with a ton of tutorials but havent been able to find any that will fulfill ALL the user stories.
Here is the link to my codepen.
please forgive the styling as I have just been focused on the JS.
Thanks again for the help!

I think the problem is that you are performing calculations when an operator is pressed. Which makes it impossible to go back and change the operator. So when you press 9* and then use another operator (+,-,*,/), it still has a 9 displayed - so it takes the first 9 * the 9 that is still displayed and gives an 81.

You need to wait on performing the calculation so you can go switch the operator. So if you press the 9 * and then +, it needs to change the * to +, instead of making that calculation.

You need to only “doMath” when the = is pressed, and just change the operator when one of those is pressed.

Thanks for taking another look. What you are saying and how you explained it make perfect sense. I will try implementing your solution!
Thanks again for the help…I need ALL the help I can get. Ill let you know how it turns out!