My calculator - feedback welcome

hey everybody, if you could take a look at my calculator and help check for bugs, I’d really appreciate it - it’s fairly polished at this point, which means it’s getting harder for me to spot issues:

the big sticking point for me was the “clear” functionality - I wasn’t super confident in exactly what the “AC/C/CE/etc” buttons should do, and looking into it yielded mixed results… so I just reverse engineered the built-in calculator on my macbook

anyways, thanks for looking / any feedback you have

I am behind you in the curriculum so I can’t identify exactly where in the code there is an error, but the decimal button needs left margin to create space between it and the zero button.

1 Like

alright, thank you for pointing that out. I’m on Chrome, which I think is why I hadn’t seen it - would you mind telling me what browser you’re using?

I am on an old version of Chrome. I need to update my Mac OS shameface

1 Like

alright :wink:

I changed the way it works - would you take a look and see if it fixed anything?

Looks exactly like it should now!

Could you tell me how you edited the code to fix it?

so, I’m using flexbox for the layout, and I was using the flex-grow property on the zero button. I think what that basically does is tell the browser how much bigger that element should grow in relation to the other elements. so, if one button has a flex-grow property of 1, and another is set to 2, the one that is set to 2 will be twice as big.

But evidently that doesn’t work quite right on older browsers, so I switched from using flex-grow to flex-basis which says something along the lines of “this element should always start out with this much of the available space before you start squashing other things in” - so, I set it to flex-basis: 60%, which means that the zero button will take up 60% of the box it’s in (and not more)

…I’m not the best at explaining it, but those links are really helpful - thank you very much for your help!


9 + 6 + 3 = 15

- 9 - 6 = -3