-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (20 loc) · 946 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function add() {
const numA = Number(document.getElementById("num1-el").value);
const numB = Number(document.getElementById("num2-el").value);
document.getElementById("sum-el").textContent = `Sum: ${numA + numB}`;
}
function subtract() {
const numA = Number(document.getElementById("num1-el").value);
const numB = Number(document.getElementById("num2-el").value);
document.getElementById("sum-el").textContent = `Difference: ${numA - numB}`;
}
function divide() {
const numA = Number(document.getElementById("num1-el").value);
const numB = Number(document.getElementById("num2-el").value);
document.getElementById("sum-el").textContent = `Quotient: ${numA / numB}`;
}
function multiply() {
const numA = Number(document.getElementById("num1-el").value);
const numB = Number(document.getElementById("num2-el").value);
document.getElementById("sum-el").textContent = `Product: ${numA * numB}`;
}