better winner declaration
This commit is contained in:
parent
5be31a1a51
commit
49296b1ac5
1 changed files with 6 additions and 1 deletions
|
@ -88,7 +88,12 @@ function playGame() {
|
||||||
|
|
||||||
p.textContent = `You: ${userChoice}`;
|
p.textContent = `You: ${userChoice}`;
|
||||||
p.textContent += ` CPU: ${computerChoice}`;
|
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(p);
|
||||||
document.getElementById("game").appendChild(div).appendChild(strong);
|
document.getElementById("game").appendChild(div).appendChild(strong);
|
||||||
|
|
Loading…
Add table
Reference in a new issue