My Calculator App - Feedback

Hi all,

This is my calculator app, which is complete. I had some help from an article about this challenge, but after reading it, tried to build it myself.

This is the result, any feedback would be great.

My Calculator App

Some caveats:

  • If you press a number,operator,number,equals,decimal,operator in that order, something goes wrong. I really don’t know how to fix this, but it still passes all the user stories for the challenge I think.
  • If you end up with a long number/non-terminating number E.G. 10/3 then it overflows it’s container. I’ve set overflow to hidden, but could not seem to get overflow X: scroll to work…
  • There are possibly some crazy combinations of buttons that will break the calculator, but I’ve tried to cover as many as possible. I feel like after a while this stops being an advanced project and becomes something that a very experienced JS dev would need to do…

Thanks again,

Instead of using overflow: hidden, why keep track of how many digits your display will hold and round the number to fit the display?

Good idea, I had considered rounding the numbers but wasn’t really sure how to best go about it.

I guess if I test to see if the number is longer than then number of characters that will fit, and if it passes, round it to that maximum number of characters, that would work. Making sure to do that test/round each time a calculation is made (build it into my calculate function).

I’ll have a look at it this evening and see what I can do.