better winner declaration

This commit is contained in:
array-in-a-matrix 2021-06-16 13:59:16 -04:00
parent 5be31a1a51
commit 49296b1ac5

View file

@ -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);