Javascript calculator project - feedback

Here’s a first look at the calculator I built using React:

Update: bugs fixed, all test cases pass…handling of button click could be better modularized.

I found a few problems:

  1. When you “resolve” and equation (i.e press equals) and then press a number, it just concatenates said number onto the current answer. I don’t know if you intended this but it is not what the example does.

  2. You can type in number decimal operator decimal etc (5 + . + . + .) This does not make sense. You cannot have a decimal without a following number.

  3. You can start a number with multiple zeroes.

  4. You mispelt subtract wrong as an element’s id and thus failed a test.

That’s all I have spotted for now. Good start, but I noticed you still have 8 more tests to pass. Fixing some of the four things I mentioned should go some way to passing said tests.

1 Like

@kudeh Nice!
Here is my opinion:

  • I suggest using a monospace font.
  • And increasing the font size a bit.
1 Like

Nice feedback, will fix my approach to the problem and get rid of those bugs :+1:

Thanks, that will make it look better. Will add that to my design