From 49296b1ac56c9e555624c82b486a3a9c8adbbce5 Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Wed, 16 Jun 2021 13:59:16 -0400 Subject: [PATCH] better winner declaration --- index/RPS.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index/RPS.js b/index/RPS.js index 6966da5..5431c9e 100644 --- a/index/RPS.js +++ b/index/RPS.js @@ -88,7 +88,12 @@ function playGame() { p.textContent = `You: ${userChoice}`; p.textContent += ` CPU: ${computerChoice}`; - strong.textContent = winner; + + if (winner != "Tie") { + strong.textContent = "Winner: " + winner; + } else { + strong.textContent = "Tie game!"; + } document.getElementById("game").appendChild(div).appendChild(p); document.getElementById("game").appendChild(div).appendChild(strong);