Build a JavaScript Calculator - Front End Development Libraries

Front End Development Libraries - Build a JavaScript Calculator

Hello. I need help =/ , I haven’t been able to pass the calculator challenge for 3 days.
I am building the calculator using react
I can’t find a solution to point 15 described below.
I have dedicated a lot to the projects and I cannot pass the test for the 15th point of the challenge.
I’ve tried conditionals, regular expressions, everything and I can’t pass the test.
My codePen code is here.

on my calculator i am constructing 5 * - + 5 = -25
but the challenge requires that 5 * - + 5 = 10

“point that I can not overcome”
13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.
The sequence “5 * - + 5” = should produce an output of “10” : expected ‘-25’ to equal ‘10’
AssertionError: The sequence “5 * - + 5” = should produce an output of “10” : expected ‘-25’ to equal ‘10’

Do you understand why you are failing the test? What I mean is do you understand why
5 * - + 5 should be 10 and not the -25 your calculator generates?

Thank you very much for answering. if I understand what the point asks for.

technically, what you are asking for is that 5*-+5 remove the *- sign and add 5 + 5.
currently the calculator does the reverse process. takes 5 * 5, that is, takes the first operator and removes the others.
I understand that the point of the point is that it takes the last operator and not the first.
I just don’t know how to transfer it to logic, I’m sure it should be simple but I’m stuck, I can’t find a way around it.

There is probably more than one way to do this.

For eg you can probably use a filter method. You can also use a loop and parse the text with some conditionals. I think you should find a way that you think will work and then if you are stuck, present your algorithm here for someone to review it and suggest corrections.

What is your current method supposed to do? (Show us some pseudocode or describe the algorithm)