Please don’t judge me for the style because I know it is terrible right now.
The thing is I cant pass User Story #13. I’ve spend hours and still I got no solution!
Please I would really appreciate if someone could help me out there!
Currently your handleEquals() function is passing your statement into eval without consideration to the operator order. Eval will return an error when passing in something like 5 - * 5, so you need to implement some logic that considers the order of these operators. My first thought is that this may require picking apart expression before being evaluated and keeping track of the last pressed operator (unless it is "-").
gabei’s reply is spot on. Something that helped me when I was stuck on this specific test was considering how my iphone calculator handles this test. Just like gabei said, I noticed it cancelled out chaining operators unless the last one was a minus to preserve negative numbers. Also I was using react 18 and my test would not pass even when I got the logic correct. If you feel that the logic is 100% correct and it still is not passing, then consider downgrading to react 17.0.2.