Welcome to the JavaScript Calculator project! This is a simple and functional calculator built using HTML, CSS, and JavaScript. It supports basic arithmetic operations, decimal inputs, and keyboard interactions for a smooth user experience.
- Basic Operations: Addition, Subtraction, Multiplication, and Division
- Keyboard Support: Use both mouse and keyboard to interact with the calculator
- Floating Point Calculations: Supports decimal calculations
- Clear and Reset Functions: Easily manage your calculations
- Press Styles: Interactive button press effect for a better user experience
- Responsive Design: Works seamlessly on different screen sizes
You can try the live demo of the calculator here.
- HTML5: For the basic structure of the calculator
- CSS3: For styling and creating a responsive layout
- JavaScript (ES6): To handle the calculator logic and operations
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/nguyenm-giau/JavaScript-Calculator.git
-
Open
index.html
in your browser to see the calculator in action.
- Mouse Input: Click the buttons to perform calculations.
- Keyboard Input: Use the following keys:
- Numbers (0-9) for input
+
,-
,*
,/
for operationsEnter
to calculateBackspace
to delete the last digitEscape
to clear the input
During the development of this project, I learned:
- Managing state in JavaScript using objects.
- Handling floating-point precision in mathematical operations.
- Implementing keyboard interactions for web applications.
Contributions are welcome! If you'd like to contribute to the project, feel free to fork the repository and submit a pull request.