JS Calculator help! (15 out of 16 tests passed)

Hi everyone,
I have almost donde the calculator, but I’m stuck with the last test, because I don’t even know which requirement the calculator doesn’t meet.
The test that fails is:

  1. Pressing an operator immediately following “=” should start a new calculation that operates on the result of the previous evaluation

According to myself, it works, so I don’t understand what’s the issue.

My codepen’s project is this:

Click to Access to the Calculator

I would be so thankful if you can help me :slight_smile:

Hello there,

Open your devTools, and type: 5+3 =, then -. You should see this error:

react-dom.production.min.js:32 Uncaught TypeError: Cannot read property ‘0’ of null
at opReducer (pen.js:49)

It has to do with your regexLastNum function.

Hope this helps

1 Like

Thanks!! It helps me a lot. Finally I could figured it out