-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc.js
53 lines (47 loc) · 1.22 KB
/
calc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const history = document.getElementById("h_value");
const output = document.getElementById("out_value");
const number = document.querySelectorAll(".number");
const multiply = document.getElementById("multiply");
const divide = document.getElementById("divide");
const add = document.getElementById("add");
const sub = document.getElementById("sub");
const remainder = document.getElementById("remainder");
const equals = document.getElementById("equals");
const clearOne = document.getElementById("CE");
const clearAll = document.getElementById("C");
function multiplication(a, b) {
return a * b
}
function remaining(a, b) {
return a % b
}
function division(a, b) {
return a / b
}
function subtraction(a, b) {
return a - b
}
function addition(a, b) {
return a + b
}
function equalsTo(num) {
output.innerText = num;
}
function printOnOutput(s) {
output.innerText = s;
}
function printOnHistory(s) {
history.innerText = s;
}
function addOnOutput(s) {
return output.innerText + s;
}
function addOnHistory(s) {
return history.innerText + s;
}
function resetHistory() {
history.innerText = '';
}
function resetOutput() {
output.innerText = '';
}