Calculator javascript Feedback

JS Calculator

This is my first calculator written in js. i’m very proud how it work, if you have any tips for me and my javascript, i would appreciate. :smiley:

It’s pretty cool, nice job!

1 Like

Really very good Job!
But I have question:

if I try to calculate 4 * 5 + 1 = 21----> That is true!
if I try to calculate 1 + 4 * 5 = 25 ----> That is not true!

Is it possible that () are missing somewhere?

1 Like

Hey, this looks really nice. I do have a few suggestions:

  • Using Firefox, go to the ‘View->Zoom’ menu and activate ‘Zoom Text Only’. Then while holding down the Ctrl key scroll your middle mouse button to increase the text size manually. You’ll see that eventually the buttons break out of the calculator. This is an easy fix, just get rid of the height and width on the calculator div. If you do need to set heights/widths on elements consider using em if possible so that it shrinks/grows to accommodate text size changes. The main thing to remember is that the user should have control over what text size they need to view your page and your job is to make sure your page responds gracefully to increases in text size. Always increase the text size to at least 300% when testing.
  • With the text size increased to 300%, start typing in a long number (e.g. type in as many 9’s as you can). You’ll see the calculator start to widen. At some point you won’t be able to type in any more numbers because I’m assuming you’ve put a limit on the max number. If you have a limit you might want to consider setting the width on the calculator (in ems) so that it doesn’t contract/expand like that. Of course then people using a large text size with a narrow view port are going to get the dreaded horizontal scroll bar, so it’s a trade off.
1 Like

debug is starting XD

amazing!! i’ll try thank you!

ok i understand…do this because when you click “*” the calculator do the operation 1+4 before. she’s not a science calculator yet :smiley:

1 Like