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

Tell us what’s happening:

I have no clue what is wrong. It just won’t hide and show the reset button and options container.

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.innerText = getRoundResults(userOption);
  computerScoreSpanElement.innerText = computerScore;
  playerScoreSpanElement.innerText = playerScore;

if (playerScore === 3 || computerScore === 3) {
  winnerMsgElement.innerText = `${playerScore === 3 ? "Player" : "Computer"} has won the game!`;
  resetGameBtn.style.display = "none";
  optionsContainer.style.display = "block"
}
};
console.log(showResults());

// 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/128.0.0.0 Safari/537.36 OPR/114.0.0.0

Challenge Information:

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

You want to hide the optionsContainer and show the resetGameBtn button.

Additionally you really shouldn’t be calling showResults here, especially in a console.log statement. Nothing is returned and showResults is related to the flow of the application.

1 Like

I mean I know that, but is that not what my code says?

And the console log was so I could see a breakdown of what was occuring

Hi @redninja.happyjack :wave:

@a2937 said

You want to hide the optionsContainer and show the resetGameBtn button.

It is indeed not what your code says. Take a closer look at what you’re doing with regards to what a2937 said:

resetGameBtn.style.display = "none"; // Is showing the resetGameBtn ?
optionsContainer.style.display = "block"; // is this hiding the optionsContainer ?

Istg I reversed it back and forth before making this post. I’m going to scream. Thanks to you both

1 Like

No worries! Take a deep breath! :person_in_lotus_position:

You can use the rubber duck debugging method in the future.