Codepen link: (http://codepen.io/dannyhuang/pen/LWNdzG)
Github link: (https://github.com/kuanhsuh/jscalculator)
Thoughts
After watching practical JS, I understand how to organize an app into smaller components. In my Model(calculator object), I have all the variables and functions. After making sure everything works fine in console, I start linking the functions to the event handlers. Finally replacing the console.log with a view components that displays the result to HTML.
User Stories
[x] User Story: I can add, subtract, multiply and divide two numbers.
[x] User Story: I can clear the input field with a clear button.
[x] User Story: I can keep chaining mathematical operations together until I hit the equal button, and the calculator will tell me the correct output.
Additional Features
- [x] User can’t duplicate operators
- [x] User can’t start with operators
- [x] User can’t start with double period “..”
- [x] User can’t enter more than 12 digits