Change title and add semantic changes to dynamic messages.
This commit is contained in:
parent
1fb70f766b
commit
0a40e9ef2c
2 changed files with 8 additions and 7 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Odin Project: Rock Paper Scissors Game</h1>
|
<h1>Rock Paper Scissors</h1>
|
||||||
|
|
||||||
|
|
||||||
<div class = "buttons">
|
<div class = "buttons">
|
||||||
|
|
|
||||||
13
script.js
13
script.js
|
|
@ -61,19 +61,20 @@ function playRound(playerSelection, computerSelection){
|
||||||
function game() {
|
function game() {
|
||||||
if (pScore < 5 && cScore < 5) {
|
if (pScore < 5 && cScore < 5) {
|
||||||
const cs = getComputerChoice();
|
const cs = getComputerChoice();
|
||||||
|
const play = playRound(ps, cs);
|
||||||
play = playRound(ps, cs);
|
let psCap = ps.charAt(0).toUpperCase() + ps.slice(1);
|
||||||
|
let csCap = cs.charAt(0).toUpperCase() + cs.slice(1);
|
||||||
|
|
||||||
switch (play) {
|
switch (play) {
|
||||||
case "player loses":
|
case "player loses":
|
||||||
cScore += 1;
|
cScore ++;
|
||||||
computer.textContent = cScore;
|
computer.textContent = cScore;
|
||||||
msg.textContent = "You lose! " + cs + " beats " + ps;
|
msg.textContent = "You lose! " + csCap + " beats " + ps + ".";
|
||||||
break;
|
break;
|
||||||
case "player wins":
|
case "player wins":
|
||||||
pScore += 1;
|
pScore ++;
|
||||||
player.textContent = pScore;
|
player.textContent = pScore;
|
||||||
msg.textContent = "You win! " + ps + " beats " + cs;
|
msg.textContent = "You win! " + psCap + " beats " + cs + ".";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
msg.textContent = "It's a tie!";
|
msg.textContent = "It's a tie!";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue