MCPcopy Create free account
hub / github.com/codemistic/Web-Development / pushBtn

Function pushBtn

simple calculator/script.js:3–23  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1var inputLabel = document.getElementById('inputLabel');
2
3 function pushBtn(obj) {
4
5 var pushed = obj.innerHTML;
6
7 if (pushed == '=') {
8 // Calculate
9 inputLabel.innerHTML = eval(inputLabel.innerHTML);
10
11 } else if (pushed == 'AC') {
12 // All Clear
13 inputLabel.innerHTML = '0';
14
15 } else {
16 if (inputLabel.innerHTML == '0') {
17 inputLabel.innerHTML = pushed;
18
19 } else {
20 inputLabel.innerHTML += pushed;
21 }
22 }
23 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected