Add button to play newGame

This commit is contained in:
lolabird 2023-11-08 00:05:03 -07:00
commit 089bb290e7
2 changed files with 8 additions and 1 deletions

View file

@ -89,10 +89,17 @@ function game() {
function endGame(){
let winner = (pScore > cScore) ? true : false;
const newGame = document.createElement("button");
const newDiv = document.createElement("div");
if (winner) {
msg.textContent = "You won the game! Great job!";
} else {
msg.textContent = "You lost the game. Better luck next time!";
}
newGame.textContent = "Play Again?";
newGame.classList.add("button");
newDiv.appendChild(newGame);
msg.appendChild(newDiv);
}

View file

@ -17,7 +17,7 @@ h1{
justify-content: center;
}
.button {
.button, #msg .button {
width: 200px;
margin: 5px;
font-size: 30px;