Steve's calculator

Steve's calculator
0

#1

Hello folks,

First forum post! I started on FCC a little over a week ago and I’ve been pushing through the front end projects and algorithm challenges pretty fast. This afternoon, I built a calculator. I deliberately did this project without jQuery to make sure I could understand JavaScript DOM manipulation, and that meant writing a couple of for loops to add click handlers to all the buttons instead of just using jQuery class selectors. What do you think?

Link to my calculator

Notes:
The sqrt, exponent (^), and reciprocal (1/x) functions are not coded yet.
No keyboard handling yet, mouse clicks only.
The calculator should be able to handle (at least) the following cases:

  • Any number of unclosed parentheses will automatically be closed and nested parens should calculate correctly.
  • After entering an operator, entering another operator will replace the first one.
  • Several invalid inputs will not update the display at all (digits after close parens with no operators, multiple decimal points, extra close parens, etc.)
  • After evaluating a calculation, you can either use the result by entering an operator, or overwrite the result by entering a number.