Please review my project: JavaScript Calculator

Please review my project: JavaScript Calculator
0

#1

Intended behaviours / limitations:

  • this calculator (like many real world calculators) doesn’t show you the last operation your pressed. This was a UX choice. However, the calculator does show the last button you pressed, so you should know what you’ve been doing.
  • after pressing ‘=’, then unless you use the ‘ans’ button to store you value, then a new calculation chain is started, unless you press another operation (+,-,x,/) , in which case, the evaluated answer is used as the first term. Again, this is behavior seen in simple real-world calculators
  • The percent button doesn’t work, as I’m not sure of what functionality it should actually have - seems to behave differently on different calculators. Other buttons work.

#2

Looks great! One thing I noticed is that I’m able to input an arbitrary number of periods


#3

Oops! Thanks for the catch. Fixed it.


#4

looks good … think your fix though has downside eg you cant add number after pressing period eg cant enter 6.2 only 6.


#5

Uh-huh! My internet just crashed half way through making an improvement. The fix didn’t work - but I’ve managed to get it back up now. It will prevent you putting in extra decimal places, either together, or additional ones if there is already a decimal place in the string.