From e85acb81f0497659fb0b9e3879590a17b7642392 Mon Sep 17 00:00:00 2001 From: NetMan <13informatyka14@gmail.com> Date: Sun, 14 Jan 2024 00:57:31 +0100 Subject: [PATCH] JS: Removed unecessary, not working code --- script.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/script.js b/script.js index 74242cc..a545145 100644 --- a/script.js +++ b/script.js @@ -28,18 +28,18 @@ function operate(equals) { } function execute(operation) { - const result = operate(operation); - if ("" in operation) { - console.log("BLANK IS HERE"); + if (operation.equal) { + const result = operate(operation); + operation.a_b = !operation.a_b; + operation.equal = false; + operation.operator = ""; + if (operation.a_b) { + operation.a = `${result}`; + operation.b = ""; + } + console.table(operation); + console.log(`Result: ${result}`); } - operation.a_b = !operation.a_b; - operation.operator = ""; - if (operation.a_b) { - operation.a = `${result}`; - operation.b = ""; - } - console.table(operation); - console.log(`Result: ${result}`); } let operation = { @@ -47,6 +47,7 @@ let operation = { operator: "", b: "", a_b: true, + equal: false, } let equal = ""; @@ -57,20 +58,20 @@ function click(value) { operation.a += value; } else { operation.b += value; + operation.equal = true; } } else if (value == "=") { execute(operation); } else { if (operation.operator == "") { operation.a_b = !operation.a_b; + operation.operator = value; + } + if (operation.a_b) { + operation.operator = value; } - operation.operator = value; } console.table(operation); - - if ("" in operation) { - console.log("BLANK IS HERE"); - } } function generateGui() {