Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/katherinekhine/simple-calculator
Simple web-based calculator
https://github.com/katherinekhine/simple-calculator
html typescript
Last synced: about 2 months ago
JSON representation
Simple web-based calculator
- Host: GitHub
- URL: https://github.com/katherinekhine/simple-calculator
- Owner: katherinekhine
- Created: 2024-08-17T16:29:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-28T13:06:10.000Z (4 months ago)
- Last Synced: 2024-08-28T14:27:56.367Z (4 months ago)
- Topics: html, typescript
- Language: TypeScript
- Homepage: https://simple-calculator-delta-ivory.vercel.app/
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Basic Web Calculator
This is a simple web-based calculator that performs basic arithmetic operations: addition, subtraction, multiplication, and division. It is built using HTML, and JavaScript.
## Features
- **Addition**: Adds two numbers.
- **Subtraction**: Subtracts the second number from the first number.
- **Multiplication**: Multiplies two numbers.
- **Division**: Divides the first number by the second number (handles division by zero).## Usage
1. Enter the first number in the Number 1 input field.
2. Enter the second number in the Number 2 input field.
3. Click one of the operation buttons:
- Add: To add the two numbers.
- Subtract: To subtract the second number from the first.
- Multiply: To multiply the two numbers.
- Divide: To divide the first number by the second.
4. The result will be displayed below the buttons in the "The Answer is:" section.## Code Explanation
The core logic of the calculator is in the app.js file:
- AddNumber(): Handles the addition of two numbers.
- SubNumber(): Handles the subtraction of two numbers.
- MultiplyNumber(): Handles the multiplication of two numbers.
- DivNumber(): Handles the division of two numbers, with error handling for division by zero.Each function retrieves the input values, performs the calculation, and updates the result in the DOM.