Let's discuss your "JavaScript Calculator"

Greetings, Fellow Campers!

This topic is for listing and review of JavaScript Calculator projects built as a part of FCC challenges. Please stick to these basic rules to keep the topic clean:-

  • Post your Codepen (or other) link to your project as a general reply to this topic.
  • For Codepen links use the following format to avoid embedding the pen:-
Project Link - [http://codepen.io/santakmishra/full/pgqOYq/](http://codepen.io/santakmishra/full/pgqOYq/)
  • Post reviews as a specific reply to the link which you are reviewing.
3 Likes

Project Link - http://codepen.io/santakmishra/full/wWvrbr/

3 Likes

I’ll play!!

Project Link - http://codepen.io/RickStewart/full/wMPRRX/

8 Likes

Project Link - http://codepen.io/hharvey84/full/ONKbWj/

1 Like

Project Link - http://codepen.io/Mizujin/full/YXJPpj?editors=1010

1 Like

Hi Mizu, I checked your project and I’m having an issue using the calculator (I’m running Chrome). The number entry and clear work as expected, but the operators do not work. If I try clicking any of them, it deletes my input.

It looks awesome by the way - definitely a lot more pleasing to the eye than mine!

1 Like

Thank you !

About the code, yes, that’s something I need to figure out :slight_smile: Numbers are stored in an array, and are flushed when you click an operand. Everything works though, you should be able to click “=” and have your result. I need to fix this though because I understand the confusion!

Project Link - http://codepen.io/evilloria/full/MyRorO/

Project link: Calculator

Project Link - http://codepen.io/tiagofucilini/full/XKJBVw/

Project Link: http://gadzev.github.io/javascript-calculator/

Good look. Check floating point math for numbers less than 1.

hi everybody! i’ve finished my retroCalc :clap:
DEMO: http://fngr2911.github.io/jscalc/
REPO: https://github.com/FNGR2911/jscalc

2 Likes

Project Link - https://codepen.io/FaizAhmadF/full/XKmgmq/
Please give your feedbacks!

Project link: http://codepen.io/Selhar/full/dXoByL

Project link: http://codepen.io/janschreiber/full/dYNRpY

1 Like

Just finished the javascript calculator. http://codepen.io/MichaelMorris/full/KMPEYP/. Would appreciate any feedback. Thanks.

Here’s mine:

http://codepen.io/PenCoderr/pen/KMzooN?editors=0110

I found this one pretty challenging.

A few things that I wanted to make sure worked right:

  1. If you enter a number, press an operator and than change your mind and press another operator, it doesn’t hang. For example, if you type “9” and then “+” but realize you wanted to press “x” instead, you can and it will still work. So this will give you the right answer: 9 + x 3 = [will give you 27]

  2. I wanted to make sure the answer always fits into the display. So if you do “100 ÷ 3”, you will get “33.333333” without any digits cut off at the end.

  3. You don’t need to clear before doing the next calculation. If you do “4 + 12 =”, you’ll get 16 as the answer. Then you can immediately type in your next expression instead of clearing first.

  4. I realized when I was done that it wasn’t touch-enabled. Had to go fix that. LOL

  5. You cannot enter more than one decimal point.

  6. AC clears all and CE clears the last entry, as you would expect and pressing CE after the last result gives you 0 on the display like it should.

  7. Operator precedence seems to work. 2 x 5 + 5 x 2 = 20, not 30.

  8. I didn’t make it keyboard-enabled. Didn’t think about it. I might come back and include it at a later date.

  9. It has a bug that I’m not sure how to fix. If anyone has an answer, please share! The problem is when you have a negative number that is 9 digits long. The display has faint inactive LCD lines in the background where there are no digits, reminiscent of a real LCD calculator. The numbers line up in all other cases EXCEPT when there is a 9-digit negative number. You can see this by typing “123456789” and then pressing the “+/-” button. For some reason, the digits move over slightly and the LCD lines are not lined up with the numbers anymore.

  10. No leading or trailing zeroes.

  11. The buttons all line up when viewing at 100% but if you zoom in on your browser, the + button moves out of alignment. It’s floated right. I don’t know why this is happening and don’t know how to fix it. I need to learn CSS better. LOL

If anyone finds any more issues, please point them out to me!

Thanks!

4 Likes

Project Link - https://codepen.io/bakajan/pen/pbgQbN?editors=1010

Any tips or code cleaning suggestions would be helpful, thanks.

Might have to improve the functionality, as in evaluating operators via precedence and showing the result after pressing an operator, but I did this in a day and I’m very happy with how it looks! It’s keyboard compatible but uses ‘space’ for evaluating and ‘delete’ for backspacing. This mostly had to do with backspace and enter having other functions in most browsers. Please inform me of any bugs or weird behavior.

2 Likes