diff --git a/script.js b/script.js index da792e5..1cf6a6c 100644 --- a/script.js +++ b/script.js @@ -43,6 +43,13 @@ function displayEval() { function displayOperator() { 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) { topScreen.textContent = mainScreen.textContent + " " + this.textContent + " ";