I have been stuck on this for weeks. I have a calculator that makes a string with the buttons pressed but I am out of ideas for this next part. It is the only failure.
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’JavaScript Calculator for Operators
Can you be more specific what you are asking from the forum? Do we need to see your code in order to help you?
I am asking for more of a guidance on where I can begin here.
For example “5*-+5” I need to tidy this up so I can use eval to calculate it correctly and make it equal 10 not -25
My code: https://codepen.io/Olliewe88/pen/ExddwrM?editors=1111
There are a couple of ways you could approach this. Whenever I have to deal with fixing up strings, regular expressions usually come to mind.