Hi Guys, Greetings from my Side.
Recently, I had completed Drum_machine Project and after that, yesterday I embarked on Calculator Project. After 17-18 hours, I have come up with this. Calculator (croy47.github.io)
Although this passes all the requirement of FCC’s test suite, I know this calculator has multiple bugs. Since, I have been doing this for very long and I feel a bit tired. I decided to put it up here for you guys to review the way code has been written and suggest changes that could make it easier for me to approach the problems i am facing while trying to make it work smoothly.
Problems:
- When = is pressed, It shows the same result in both currentNum and calculated.
and result is different in some cases where javascript finds it difficult to caculate like 0.1 + 0.2.
- It sometimes breaks the loop of calculation despite a valid input.
ex: press AC, then 9, then sqrt button, and then anything like ± leads to unexpected result 0.
36 + 64 = 100 and then sqrt button. Ugh! No. This was not expected. Disappointed.
- percentage button problem
ex: press 56 + 36 and then percentage shows 0.36
These are just a few examples. A lot more remains to be fixed.
-
Error handling is not proper.
-
I will have to better organize my code, I feel as it has become difficult for me to solve a few problems in this app. Your comments are welcome.
-
To those viewing it on phone, please excuse me for the stupid look it gives, This was easiest to solve but I need break for a few hours, so i left it like that. I am more concerned with its functionality at this moment.
7 onwards - I am sure you will find more.
Source Code - croy47/Calculator (github.com)
I don’t know if I have learnt things well. If I am too slow to solve a simple projects like this after giving it so much time. Your comments are welcome.
A few motivating words will also help. In dire need of motivation at this moment.
Thanks a lot guys for your time reading this.