From a4621cda0068d27f81dd698b1fdbb2d5f9f7078f Mon Sep 17 00:00:00 2001 From: lolabird Date: Wed, 27 Dec 2023 21:16:55 -0700 Subject: [PATCH] Fix how equals handles numbers that have no operator --- script.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.js b/script.js index 764a6b9..c964b6c 100644 --- a/script.js +++ b/script.js @@ -28,8 +28,8 @@ function displayEval() { let calc = new Calculator; let result = 0 - if (topScreen.textContent === "0") { - calc.calculate(mainScreen.textContent); + if (topScreen.textContent === "0" || !inOps) { + result = calc.calculate(mainScreen.textContent); } else { topScreen.textContent += mainScreen.textContent; console.log("main: " + mainScreen.textContent);