This is a basic calculator application built using HTML, CSS, and JavaScript. The application provides basic arithmetic calculations such as addition, subtraction, multiplication, and division.
You can try the live app here
To use the calculator, simply enter a number by clicking or keyboard input, choose an operation, enter another number, and click the equals button to display the result. The calculator also provides the option to clear the input or delete the last entered character.
- HTML
- CSS
- JavaScript
- Basic arithmetic operations: addition, subtraction, multiplication, and division.
- Clear input and delete last entered character options.
- Dynamic button animations on click.
- Decimal button can only be used once per input.
- Backspace button removes the last entered character without affecting the result.
- Consecutive operator clicks result in the use of the last clicked operator.
- Calculation is prevented if equal is pressed, and the last clicked button is an operator.
- Precision variable allows adjusting the number of decimal places displayed.
- Automatic removal of leading 0 if a number is inputted with one.
- Automatic addition of 0 before the decimal point if it's the first input. Automatic removal of 0 if the decimal point is deleted.
- Maximum number of characters displayed on the calculator screen is limited to prevent overflow.
This project was built as part of my web development course. The original idea came from The Odin Project's Calculator Project.