Review DOM Manipulation by Building a Rock, Paper, Scissors Game - Step 5

Tell us what’s happening:

Still get the error “you should update winnerMsgElement”.

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

const playerScoreSpanElement = document.getElementById("player-score");
const computerScoreSpanElement = document.getElementById("computer-score");
const roundResultsMsg = document.getElementById("results-msg");
const winnerMsgElement = document.getElementById("winner-msg");
const optionsContainer = document.querySelector(".options-container");
const resetGameBtn = document.getElementById("reset-game-btn");

function showResults(userOption) {
  roundResultsMsg.innerText = getRoundResults(userOption);
  computerScoreSpanElement.innerText = computerScore;
  playerScoreSpanElement.innerText = playerScore;

  if (playScore == 3) {
    winnerMsgElement.innerText ="Player has won the game!";
  } 
  else if (computerScore == 3) {
    winnerMsgElement.innerText = "Computer has won the game!";
  }
  
  resetGameBtn.style.display = "block";
  optionsContaine.style.display = "hide";

};

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15

Challenge Information:

Review DOM Manipulation by Building a Rock, Paper, Scissors Game - Step 5

Hello there!

You have some typo issues and some syntax issues but don’t worry, here are the issues you have and how you can adjust your code to meet the requirements.

You have a typo here

and here

You also used the equality operator in your if statement which gives you two options either true or false, however, you want your variables to be always equal to a certain quantity which makes the strict equality operator === ideal.

Finally, you do not need an else if case you only need an else case. Make sure to also confirm the if-else conditional syntax.
With these changes, your code should perform its tasks efficiently.

Did the changes. it looks now like this:

if (playerScore === 3) {
winnerMsgElement.innerText =“Player has won the game!”;
}
else
winnerMsgElement.innerText = “Computer has won the game!”;
}

resetGameBtn.style.display = “block”;
optionsContainer.style.display = “hide”;

but still got the message.

In the console I have the Reference Errors: Can’t find the variable playerScore and computerScore.

When you want to hide elements, you use a display of “none” and not “hide”

Your else statement is missing an opening curly brace.