Javascript /Jquery Calculator

Hi, I’m having issues passing the Javascript Calculator test #13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign. Can someone please assist me with this issue? Here’s my code:
https://codepen.io/hartmanai/pen/PoPRBJa

image
This is the string the script passes for that test.
Your calculator just adds each operator to the string. What it should do is:

  • I press 5 => Display shows 5.
  • I press * => Display shows 5*.
  • I press - => Display shows 5*-, because we want to be able to use negative numbers.
  • I press + => Display shows 5+, because pressing an operator other than - should overwrite the previous operators.
  • I press 5 => Display shows 5+5.
  • I press = => Display shows 10, test passes.

I’m needing assistance with the operators in my code so it will pass the tests . I understand that my code just adds each operator but I can’t figure out how to get it to overwrite the previous operators so it will pass the test.