-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (24 loc) · 818 Bytes
/
script.js
File metadata and controls
30 lines (24 loc) · 818 Bytes
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
function clc(){
let digit1 = parseFloat(document.getElementById("num1").value);
let digit2 = parseFloat(document.getElementById("num2").value);
let oper = document.getElementById("operator").value;
let op = document.getElementById("output");
switch(oper){
case '+':
op.textContent=digit1+digit2;
op.style.backgroundColor="green";
break;
case '-':
op.textContent=digit1-digit2;
op.style.backgroundColor="green";
break;
case '*':
op.textContent=digit1*digit2;
op.style.backgroundColor="green";
break;
case '/':
op.textContent=digit1/digit2;
op.style.backgroundColor="green";
break;
}
}