The idea is to make a basic calculator. LIVE LINK:https://optimistic-montalcini-d93b11.netlify.app/
- Responsive design (except for Galaxy Fold)
- Can handle up to 10 digits.
- Display the current value and the previous entry.
- Perform basic mathematical operations when clicked (+ - x ÷).
- AC clears the current value and changes display input to 0.
- ± changes the sign of the current displayed value (positive <-> negative).
- Backspace (pink arrow) deletes the rightmost digit displayed on the display.
You can press number keys to perfom calculations.
Use corresponding keybouard keys for ÷ × - +.
Special keys are as follows;
- AC/CE => Delete key
- ± => Insert key
- Backspace => Backspace key
Shows the equation, and current input
- Clicking on any number key (incl. decimal key) changes AC to CE.
- CE clears the current entry.
- Clicking on any operation key changes CE back to AC.
If you hit a number, followed by an operator, followed by an equals, the calculator will give the result such that: e.g.
2 + = —> 2 + 2 = 4
2 - = —> 2 - 2 = 0
2 × = —> 2 × 2 = 4
2 ÷ = —> 2 ÷ 2 = 1
If you hit the equals key after a calculation is completed, the last performed operation will occur again based on the current calculated value.
e.g.
keys 10–2
equal. Calculated value is 10 - 2 = 8
equal. Calculated value is 8 - 2 = 6
equal. Calculated value is 6 - 2 = 4
equal. Calculated value is 4 - 2 = 2
equal. Calculated value is 2 - 2 = 0
0 typos will automatically convert into a float number,
e.g. 0012345 => 12345
00.1245 => 0.12345
.123 => 0.123
-.12 =>-0.123
If you hit any operator key one after the other, the last operator key will be applied for the calculation.
e.g. if you hit 5 + - ÷ × then the last operation will be applied to the calculation, i.e., 5 x
- Clone this project locally
- Run
npm install
in your bash/command line - Run
npm start
in your bash/command line
- Run
npm test
in your bash/command line
Add-on packages include:
- Jest
- Babel
- Parcel Bundler
Color inspiration from Color Hunt
Background pattern from Transparent Textures
Fonts from Google Fonts
Icons from Font Awesome