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

Tell us what’s happening:

my last else if not working when i am applying el.style.display on elements its says this " You should hide the optionsContainer and if the player or computer has reached three points. You should show the resetGameBtn button if the player or computer has reached three points.
help me to understand this problem

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) {
   return winnerMsgElement.innerText = "Player has won the game!"
  } 
  else if(computerScore == 3) {
     winnerMsgElement.innerText = "Computer has won the game!"
  }
   else if (playerScore == 3 || computerScore == 3) {
      el.style.display = resetGameBtn
      el.style.display(optionsContainer = "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/126.0.0.0 Safari/537.36

Challenge Information:

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

This step is not super clear. When they said to use el.style they meant to use the style property of the element (el means element). So don’t actually write el. Replace el with the correct element name.

this is still not working

else if (playerScore == 3 || computerScore == 3) {
resetGameBtn.style.display = resetGameBtn;
optionsContainer.style.display = “none”;
}

This is not how you display the button in css. You need to set the display to “block” instead

i found its solution and now i am shearing it with you guys

– removed by moderator –

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

ok sir i got it and i am sorry i will remember it next time.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.