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

Tell us what’s happening:

It says, you should update the winnerMsgElement but I did that in the code with innerText and it works fine, I don’t understand what’s the issue.

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) {
  if (playerScore === 3 || computerScore === 3){
      winnerMsgElement.innerText = `${playerScore === 3 ? "Player" : "Computer"} has won the game!`;
    optionsContainer.style.display = "none";
    resetGameBtn.style.display = "block";
  
  }
  roundResultsMsg.innerText = getRoundResults(userOption);
  computerScoreSpanElement.innerText = computerScore;
  playerScoreSpanElement.innerText = playerScore;


};

// 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/127.0.0.0 Safari/537.36

Challenge Information:

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

The above code is correct and it’s working on my end. But the order of the if statement in the challenge editor is wrong. You need to move it after playerScoreSpanElement inner text. In the challenge starting there are two empty lines 43, 44 for that new code

1 Like

Thanks! It worked now that I put it after the playerScoreSpanElement.