Get minus sign to act as both a sign change toggler and operator depending on on the context

This commit is contained in:
lolabird 2023-12-28 09:00:35 -07:00
commit 013623226d

View file

@ -43,6 +43,13 @@ function displayEval() {
function displayOperator() { function displayOperator() {
let result = 0 let result = 0
let operator = this.textContent;
if (operator == "-" && (isNaN(mainScreen.textContent) || mainScreen.textContent == "0")) {
console.log("Entering changeSign");
changeSign();
return;
}
if (topScreen.textContent == "" || !inOps) { if (topScreen.textContent == "" || !inOps) {
topScreen.textContent = mainScreen.textContent + " " + this.textContent + " "; topScreen.textContent = mainScreen.textContent + " " + this.textContent + " ";