Help with React calculator


Would somebody mind taking a look over my React calculator -

This has been quite difficult in terms of getting my head around the logic but I’m nearly there! The calculator has all of the major functionality but I still have 3 tests to pass:

  • Not accepting two decimals one after the other

  • Handling two operators one after the other

  • Managing the decimal places - although I do seem to have 4 points of precision so I don’t know why this is failing.

I haven’t got a clue where to start in terms of implementing these things and feel like I need to take a step back. Any suggestions or pointers in the right direction would be very welcome, as would any generic feedback about my implementation.


I am also a bit of a noob so take my advice with a grain of salt.
However, you need to put in a parameter that compares the first operand to the second and that way you can make exceptions to certain operands.
2. You can make it round better by using the math.Floor() method.