From 0516f4a9248c3054371ccb08495940616b5fee93 Mon Sep 17 00:00:00 2001 From: Code G Date: Thu, 12 Sep 2024 14:07:51 -0700 Subject: [PATCH] Refactored Code --- .DS_Store | Bin 0 -> 6148 bytes script.js | 31 ++++++++++++------------------- 2 files changed, 12 insertions(+), 19 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..decf1479817d613b7361eb9b066be052cb30ff36 GIT binary patch literal 6148 zcmeHKyH3ME5S$BC7B#1~NU75od# z-krdYgbE>qcBQ+y?CtpW#*Wtq!1S(1U7!P?#U|Kjvs+;@FRf+`@7X3AxkfVX4u)Ae zt3|5guPPw-u89z1TwqbYe{T=PxipL8(p=f(23}{UjUu zeaoLj_8h)j;|OTm{IAHIF+Ri;^9p0Rg0a9I60Q?+@AE3d>{S@Dj+!c<3aA1 secretNumber) { - if (score > 1) { - document.querySelector(".message").textContent = "📉 Too high!"; - score--; - document.querySelector(".score").textContent = score; - } else { - document.querySelector(".message").textContent = "💥 you lost the game!"; - document.querySelector(".score").textContent = 0; - } - - //When guess is too low - } else if (guess < secretNumber) { + //When guess is wrong + } else if (guess !== secretNumber) { if (score > 1) { - document.querySelector(".message").textContent = "📉 Too low!"; + displayMessage(guess > secretNumber ? "📈 Too high!" : "📉 Too Low!"); score--; document.querySelector(".score").textContent = score; } else { - document.querySelector(".message").textContent = "💥 you lost the game!"; + displayMessage("💥 You lost the game!"); document.querySelector(".score").textContent = 0; } }