JS Calculator 7th test failing

This is frustrating. There seems to be a glitch in test #7 but it could be me. My #display element renders ‘0’ when you click the clear button. This code passes the tests up to test #7. After moving on and adding a boolean state (evaluated: false) to check if an answer has been found prior to clicking ‘=’ again, test #7 breaks! What am I doing wrong?

Here is a link to my CodePen

Welcome to the forums.

I can’t tell from looking over things what the problem is yet, but the failing test complains about a Script error which I take to mean that something the test is doing with your program is not working and the script is aborting during the test (or something similar). I saw some console.log() calls in your code, so you must be watching the console; I would suggest viewing your pen in debug mode, open the console, and run the tests to watch what happens. You may need to add more logging, especially of state, as it changes.

Also, you may be having problems with mutating state. If you need to set state with state, use a function like

this.setState((state) =>
                return {
                  display: state.display + num

I found the problem code. Deep in my if else tree within a for loop is this else statement

else {
   reduced = reduced * ParseInt(formula[i+1]);

really not sure why this is effecting the clear() function which has nothing to do with it.