A beginner-friendly calculator built with HTML, CSS, and JavaScript. This project is part of my journey to understand JavaScript logic, functions, and DOM manipulation.
-
Clickable buttons for numbers (0–9) and operators:
- ➕
+Addition - ➖
-Subtraction - ✖
xMultiplication - ➗
/Division
- ➕
-
✅ Clear button (
CLEAR) to reset the display -
✅ Equals button (
=) to calculate results -
🖥️ Results display updates immediately as you type
⚠️ Note: The calculator is still a work in progress.
Screenshot showing the calculator interface with numbers and operators.
- Open
index.htmlin your browser. - Click number buttons to input digits.
- Click operator buttons (
+,-,x,/) to select an operation. - Click
=to see the result. - Click
CLEARto reset the calculator.
| Action | Display |
|---|---|
| 5 + 3 = | 5 ➕ 3 = 8 ✅ |
| 7 x 2 = | 7 ✖ 2 = 14 ✅ |
| 9 ÷ 0 = | 9 ➗ 0 = ❌ Error |
- HTML – structure
- CSS – styling and layout
- JavaScript – logic and interactivity
This project helped me:
- Understand HTML structure and CSS styling
- Learn JavaScript logic, functions, and event handling
- Manage state for first/second operands and operators
- Make interactive UI elements like buttons with hover effects
Here’s what I plan to add next:
- Prevent numbers from spilling over the results screen
- Support multiple chained operations
- Handle division by zero and other errors gracefully
- Improve UI responsiveness for mobile and desktop
- Add keyboard input support
- Add animations for button clicks
- Optionally, store history of past calculations