Calculator Feedback Appreciated!

I think I covered all the “gotchas.” Let me know what you think!

Project Link - http://codepen.io/lacyjpr/pen/qRzgGL

1 Like

Very nice!

I am one of those weird people who search for bugs and I found a couple.

  1. your “C” button clears only one number at a time. it also erases some of the digits and operators already entered.

  2. If you “C” just after completing an equation it will erase the number like it should but if you enter another number it adds some extra numbers in.

Thanks @sebalex11 !! I really appreciate the bug hunting!

The “C” button is supposed to clear only one number at a time. Are you noticing that it sometimes clears more?

As for the 2nd bug…ugh! I need to figure that one out!

Thanks again!

My mistake. I don’t think I’ve run into a calculator that let me do that, all of mine used that button to clear the current number. like if I type 10 + 10, don’t press “=” sign, and then press C it would only clear the second (current) 10.

No problem. I’m actually am just finishing mine up. I need to figure out how I want its final look to be.

I think I may be the one who doesn’t know how calculators work…

Still working on the 2nd bug:)

Thanks again!

@sebalex11

Fixed the 2nd bug so if you hit clear after entering an equation and hitting equals, it now clears the number acting like an all clear button.

I don’t know if I can fix the first bug: the numbers are stored individually in an array, so I can eliminate the last number entered (because I know its length), but it doesn’t work for numbers after that, because there isn’t a way to track how long those are.

Thanks again!

Refactored the clear function: Now if you use it after entering equals, it behaves like it does the rest of the time, removing one character at a time.

Project link - http://codepen.io/lacyjpr/pen/qRzgGL

Nice work on the calculator. The colors are a bit much but it looks good.

Thanks @Gorbax9 I appreciate the feedback!

I should tweak the colors but I’m bad at them. I picked the cyan body color & let Adobe’s color wheel (https://color.adobe.com/create/color-wheel/ ) help me pick a complementary color for the yellow buttons.

Any suggestions for a less zany scheme?

Refactored to use generic functions instead of an event listener for each key.

Tweaked colors, added keyboard input & sound. (Not sure about sound, it acts a little flaky)

–Project Link http://codepen.io/lacyjpr/pen/qRzgGL