# Need Some Feedback about my JavaScript Calculator

**URL:** <https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434>\
**Category:** I Built This\
**Created:** [August 12, 2016, 6:15am UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434 "2016-08-12T06:15:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![baskoroi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/baskoroi/32/13146_2.png) [@baskoroi](https://forum.freecodecamp.org/u/baskoroi)\
**Post date:** [August 12, 2016, 6:15am UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/1 "2016-08-12T06:15:39Z")

</div>

# The Project

So here’s the calculator I’ve made: (plain HTML5, plain CSS3, plain JS)

> **[FCC: KAFEIN Calculator](https://codepen.io/baskoroi/pen/AXYzJd)**
>
> ...

I never thought this project would be real hard in the start. After designing the calculator and diving into the JS, the calculations made my head steam. (Not in the sense that I was angry, tho.)

I tried to cover most of the potential bugs that may arise in the project above. If you have comments or suggestions, feel free to drop them in here. And if you have seen any bugs I haven’t known, feel free to reply me here.

# Hints:

Luckily I remembered about the [postfix notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation) and later found the [shunting-yard algorithm](https://en.wikipedia.org/wiki/Shunting-yard_algorithm), to convert any infix notation, e.g. “3 + 5” to its postfix, “3 5 +”. You can check them out if you’re struggling with the calculations, postfix notations make them easier.

There’s also other factors to consider. I found that a lot of potential bugs may arise in this project, without me knowing it. These bugs are actually great lessons.

Example situations that may trigger bugs:

- Clicking operators (+, -, \*, /) more than once,
- Clicking an operator first instead of a number,
- Appended more than one decimal point into the display, etc.

That’s all from me. Thank you for reading, guys…

---

<div class="post-metadata">

**Author:** ![PortableStick](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/portablestick/32/65591_2.png) [@PortableStick](https://forum.freecodecamp.org/u/PortableStick)\
**Post date:** [August 14, 2016, 6:38pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/2 "2016-08-14T18:38:34Z")

</div>

Wow! That looks great, and kudos to you for going the extra mile and implementing shunting-yard. I found the bugs you mentioned, but have no solution as it would take a while to walk through your code. Great job, regardless! With these projects, I find that the effort put into them is more important than the final product, so I bet you got a lot more out of your project than I did with mine.

---

<div class="post-metadata">

**Author:** ![baskoroi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/baskoroi/32/13146_2.png) [@baskoroi](https://forum.freecodecamp.org/u/baskoroi)\
**Post date:** [August 15, 2016, 5:00pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/3 "2016-08-15T17:00:33Z")

</div>

Okay, thanks for your reply, I appreciate it! 😄

Plus, you’ve relieved me when you said that the process matters more than the final product. Thank you! I always tended to go nuts about the final product, hahaha…

---

<div class="post-metadata">

**Author:** ![sikandarali94](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sikandarali94/32/11020_2.png) [@sikandarali94](https://forum.freecodecamp.org/u/sikandarali94)\
**Post date:** [August 16, 2016, 12:54pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/4 "2016-08-16T12:54:23Z")

</div>

It doesn’t work. I tried calculating 98 times by 65 and it doesn’t give me the answer.

---

<div class="post-metadata">

**Author:** ![baskoroi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/baskoroi/32/13146_2.png) [@baskoroi](https://forum.freecodecamp.org/u/baskoroi)\
**Post date:** [August 16, 2016, 1:56pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/5 "2016-08-16T13:56:14Z")

</div>

Okay, @sikandarali thank you for notifying. But I’ll have to focus on my next projects right now. Given enough time, I’ll look up and debug it.

Once again, thanks for your info.

If anyone else sees another problem, feel free to reply me.

---

<div class="post-metadata">

**Author:** ![imtoobose](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/imtoobose/32/9914_2.png) [@imtoobose](https://forum.freecodecamp.org/u/imtoobose)\
**Post date:** [August 16, 2016, 6:45pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/6 "2016-08-16T18:45:53Z")

</div>

Doesn’t seem to work at all for several pairs of numbers. I don’t think you can call a project finished with significant bugs present. Debugging is half the job after all.

Nonetheless, I like the design and the fact that you didn’t go with eval() like most of us.

---

<div class="post-metadata">

**Author:** ![baskoroi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/baskoroi/32/13146_2.png) [@baskoroi](https://forum.freecodecamp.org/u/baskoroi)\
**Post date:** [August 18, 2016, 1:55pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/7 "2016-08-18T13:55:10Z")

</div>

Okay @imtoobose , thank you for the reply & advice. There’s gotta be something wrong with my “parser.”

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:08pm UTC](https://forum.freecodecamp.org/t/need-some-feedback-about-my-javascript-calculator/27434/8 "2021-06-01T18:08:52Z")

</div>

Closed on June 1, 2021, 6:08pm UTC


