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

Tell us what’s happening:

I am bit confused as to how to implement the task required, not sure if had done all or just a syntax error.

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

Challenge Information:

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

you definitely have a syntax error here. else if is separated and you shouldnt use a semi-colon there

In the updated code provided below, which addressed the syntax error, the code is still not passing…

now lets address this code. you dont have any variable called el. you are meant to substitute it with the name of the element you want to change the display.

some common display options are "none" when you dont want the element to be displayed, or "block" when you want it to be displayed.

check how you are changing the optionsContainer display style in the following code:

now do the same for your resetGameButton element, except you want it to be visible.

1 Like

Thank you very much for taking the time to point out my mistakes.

1 Like