Tell us what’s happening:
As far as I can tell, my calculator is passing the tests when I enter the calculations manually, but when I run the tests I only get 12/16.
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Challenge: Front End Development Libraries Projects - Build a JavaScript Calculator
Really need help here. I tried to debug and it seems like after certain tests the display from the last calculation isn’t clearing properly with the clear button. When I do it manually, I have no issues.
Thanks, I did look at the details but I can’t reproduce all of the errors manually.
For example: The sequence “5 + 5 = + 3 =” should produce an output of “13” : expected ‘9.55’ to equal ‘13’
When I put this in manually I get 13.
Usually, batching is safe, but some code may depend on reading something from the DOM immediately after a state change. For those use cases, you can use ReactDOM.flushSync() to opt out of batching:
Same. Spent a couple hours on this. Seems like the test cases could be updated because mine was failing because I believe it was reading in the final number entered into the calculator as the answer as opposed to the real answer that was calculated, as the function that actually calculates the answer takes place after it is pressed. Not sure, either way thank you so much!