JS Calculator automated test fail

Hi

I’m struggling to pass all the tests for the JS Calculator

Link to my CodePen

Taken individually my calculator can pass all the tests (please try by yourself in my CodePen), but when I run the Automated Test, 4 of them fail:

  • The expression 5 - 9 + 5 should produce a result of 1
  • The expression “5 * 5.5” should produce an output of “27.5” : expected ‘302.5’ to equal ‘27.5’
  • The sequence “5 * - + 5” = should produce an output of “10” : expected ‘-250’ to equal ‘10’
  • The sequence “5 + 5 = + 3 =” should produce an output of “13” : expected ‘9.55’ to equal ‘13’

I think this is due to how the Automated Test runs all its tests consecutively but I cannot find what is wrong with my code.

Thanks in advance :slight_smile:

Summary

This text will be hidden

It is because of React 18.

Switch to 17 or use ReactDOM.render (both should let your code pass)

ReactDOM.render(<App />, document.getElementById('root'))
1 Like