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

Tell us what’s happening:

I am about to freak out. I’ve searched for the same problem on the forum and I’ve tried some solutions but my code it still not working. Please help.

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);
  playerScoreSpanElement.innerText = playerScore;
  computerScoreSpanElement.innerText = computerScore;
  if(playerScore === 3 && computerScore < 3){
    winnerMsgElement.textContent = "Player has won the game!";
    optionsContainer.style.diplay = "block";
    resetButton.style.displa = "none";
  }else if(computerScore === 3 && playerScore < 3){
    winnerMsgElement.textContent = "Computer has won the game!";
    optionsContainer.style.diplay = "none";
    resetButton.style.display = "block";
  }


};

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

Your browser information:

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

Challenge Information:

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

Hi there and welcome to our community!

You’re along the right lines but there are a few issues:

  1. You have mistyped the word display in three different places.
  2. resetButton does not exist. You need to use a different variable name.
  3. Whether the player or computer have won, in both cases you should be hiding the options container and showing the reset button. In one case you have this back-to-front.

Your code should pass if you fix these issues.
Hope that helps!

1 Like

OMG! :woman_facepalming: Now it’s working! I thought there was something bigger I was doing wrong and I wasn’t even paying attention to these silly mistakes I made. Thank you very much! :pray:

1 Like