Disco Calculator is a calculator written in javascript to satisfy the User Stories outlined in freeCodeCamp's Build a Javascript Calculator
The Disco part appears when any buttons are clicked/pressed on a keyboard. The background colour and font colour of the active button changes by ramdonly assigning a colour from a preset array of hex colours.
This has been created by a combination of internal CSS, external CSS, and Javascript:
- Clicking buttons utilises the psudo CSS class
- Key presses utilisies an 'active' class
The Calculator should satisfy the User Stories set in freeSodeCamp's Build a Javascript Calculator. It heavily uses if statements with the occasional while and for loop.
The calculator is made up of two displays - the firstlocated at the top shows the calculation/equation to be calculated, the display directly below shows the buttons pressed and below that are all the calculator buttons
Event listers are created for each button, and each button has two functions called:
- Show Input Function
- Change Button Color Function (The Disco Part)
The code could have the following improvements:
- Better balance of refactoring and legibility
The calculator could have the following upgrades:
- Deleting the previous character from the equation
- Showing the history of calculations
- Dealing with large (more than 11?) integers
Please let me know if you have any other suggestions! :D