From 0a40e9ef2c0854b43400747aba5227b447cb85b4 Mon Sep 17 00:00:00 2001 From: lolabird Date: Wed, 8 Nov 2023 01:04:09 -0700 Subject: [PATCH] Change title and add semantic changes to dynamic messages. --- index.html | 2 +- script.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index fb61c5e..2754013 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ -

Odin Project: Rock Paper Scissors Game

+

Rock Paper Scissors

diff --git a/script.js b/script.js index 85c2ae8..9de39b0 100644 --- a/script.js +++ b/script.js @@ -61,19 +61,20 @@ function playRound(playerSelection, computerSelection){ function game() { if (pScore < 5 && cScore < 5) { const cs = getComputerChoice(); - - play = playRound(ps, cs); + const play = playRound(ps, cs); + let psCap = ps.charAt(0).toUpperCase() + ps.slice(1); + let csCap = cs.charAt(0).toUpperCase() + cs.slice(1); switch (play) { case "player loses": - cScore += 1; + cScore ++; computer.textContent = cScore; - msg.textContent = "You lose! " + cs + " beats " + ps; + msg.textContent = "You lose! " + csCap + " beats " + ps + "."; break; case "player wins": - pScore += 1; + pScore ++; player.textContent = pScore; - msg.textContent = "You win! " + ps + " beats " + cs; + msg.textContent = "You win! " + psCap + " beats " + cs + "."; break; default: msg.textContent = "It's a tie!";