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

Tell us what’s happening:

Im not understanding why the code doesn’t pass. I believe I am updating the winnerMsgElement if the player wins and or if the computer wins. The code does not pass and the hint says "You should update the winnerMsgElement if there is a winner. May I please get some help?

Your code so far

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

/* file: styles.css */

/* 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.textContent = roundResult;
  let playerScore = parseInt(playerScoreSpanElement.textContent);
  let computerScore = parseInt(computerScoreSpanElement.textContent);

  if (playerScore === 3) {
  winnerMsgElement.textContent = "Player has won the game!";
  resetGameBtn.style.display = "block";
  optionsContainer.style.display = "none";
} else if (computerScore === 3) {
  winnerMsgElement.textContent = "Computer has won the game!";
  resetGameBtn.style.display = "block";
  optionsContainer.style.display = "none";
}
};

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0

Challenge Information:

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

You don’t need to declare them again inside the function. You already have them on lines 15 and 16 as global variables.

You removed some of the initial code to add these two lines mentioned above. Reset your challenge and rewrite your conditions only, without modifying the rest of the code, and you should pass.