- Get the button elements of the calculator. You can use querySelectorAll and querySelector for that. The calculator buttons are: numbers, operation, equals, delete, clear, previousOperand and currentOperand
- Create a Calculator class with a constructor where the information is stored
- Implement all the operations that your calculator can perform, for instance clear(), delete() appendNumber(), chooseOperation(), compute(), updateDisplay() function
- Call the clear() function inside the constructor to clear the inputs
- Create a calculator object where the Calculator class is stored
- Add a click event listener to each number and operation button (numberButtons and operationButtons), so when you click on a button, the value is displayed. You can loop over each of the buttons using forEach.
- Add a click event listener to the equals button that computes and displays the value
- Add a click event listener to the clear button (allClearButton) that clears and updates the value
- Add a click event listener to the delete button (deleteButton) that deletes and updates the value
- Extra step: Create a getDisplayNumber() function that nicely displays the number with delamination
forked from rolandpakai/js_ws_beginner_homework_calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
annasuszter/js_ws_beginner_homework_calculator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- HTML 52.6%
- CSS 47.4%