Fix mainScreen behavior
This commit is contained in:
parent
567be17cbf
commit
f63ad42a36
1 changed files with 8 additions and 1 deletions
|
|
@ -52,6 +52,8 @@ function displayOperator() {
|
||||||
|
|
||||||
topScreen.textContent += mainScreen.textContent;
|
topScreen.textContent += mainScreen.textContent;
|
||||||
result = calc.calculate(topScreen.textContent);
|
result = calc.calculate(topScreen.textContent);
|
||||||
|
|
||||||
|
topScreen.textContent = result + " " + this.textContent + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
mainScreen.textContent = result;
|
mainScreen.textContent = result;
|
||||||
|
|
@ -60,11 +62,16 @@ function displayOperator() {
|
||||||
|
|
||||||
|
|
||||||
function displayNum() {
|
function displayNum() {
|
||||||
if (mainScreen.textContent == "0") {
|
if (mainScreen.textContent == "0" || inOps) {
|
||||||
mainScreen.textContent = this.textContent;
|
mainScreen.textContent = this.textContent;
|
||||||
|
inOps = false;
|
||||||
} else {
|
} else {
|
||||||
mainScreen.textContent += this.textContent;
|
mainScreen.textContent += this.textContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isNaN(topScreen.textContent) && isNaN(topScreen.textContent.charAt(-1))) {
|
||||||
|
topScreen.textContent += this.textContent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue