diff --git a/script.js b/script.js index 6d41d91..85c2ae8 100644 --- a/script.js +++ b/script.js @@ -87,7 +87,7 @@ function game() { } -function endGame(){ +function endGame() { let winner = (pScore > cScore) ? true : false; const newGame = document.createElement("button"); const newDiv = document.createElement("div"); @@ -100,6 +100,15 @@ function endGame(){ newGame.textContent = "Play Again?"; newGame.classList.add("button"); + newGame.addEventListener("click", resetGame); newDiv.appendChild(newGame); msg.appendChild(newDiv); +} + +function resetGame() { + pScore = 0; + cScore = 0; + player.textContent = "0"; + computer.textContent = "0"; + msg.textContent = ""; } \ No newline at end of file diff --git a/style.css b/style.css index bf3d9dc..96402cf 100644 --- a/style.css +++ b/style.css @@ -17,7 +17,7 @@ h1{ justify-content: center; } -.button, #msg .button { +.button { width: 200px; margin: 5px; font-size: 30px;