From 089bb290e7fcf53a0f37e0b116cd2789dd2ceb02 Mon Sep 17 00:00:00 2001 From: lolabird Date: Wed, 8 Nov 2023 00:05:03 -0700 Subject: [PATCH] Add button to play newGame --- script.js | 7 +++++++ style.css | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index 343e12b..6d41d91 100644 --- a/script.js +++ b/script.js @@ -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); } \ No newline at end of file diff --git a/style.css b/style.css index 96402cf..bf3d9dc 100644 --- a/style.css +++ b/style.css @@ -17,7 +17,7 @@ h1{ justify-content: center; } -.button { +.button, #msg .button { width: 200px; margin: 5px; font-size: 30px;