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

Tell us what’s happening:

Please someone should look for a solution to this.. in stuck to this for some days now.. still can’t figure it out..

Your code so far

<!-- file: index.html -->

/* 

function showResults(userOption)
  if (playerScore === 3) {
    winnerMsgElement.innerText = "player has won the game!";
    resetGameBtn.style.display = "none";
    optionsContainer = "block";  
  } 
  else if (computerScore === 3) {
    winnerMsgElement.innerText += "computer has won the game!";
    resetGameBtn.style.display += "none";
    optionsContainer += "block";
  }


};

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

Your browser information:

User Agent is: Mozilla/5.0 (Linux; U; Android 12; en-ng; CPH2387 Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36 PHX/16.8

Challenge Information:

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

From the previous step you should have this code:

function showResults(userOption) {
  roundResultsMsg.innerText = getRoundResults(userOption);
  computerScoreSpanElement.innerText = computerScore;
  playerScoreSpanElement.innerText = playerScore;
};

In this step, you shouldn’t remove the above code but add to it.
Your code doesn’t quite fulfil the criteria however:

  1. Check that the text of the winnerMsgElement matches the requirements exactly (including capitalisation).
  2. When you are showing or hiding elements, you should use the style.display property in every case but should not use a += operator.
  3. Note that you should be hiding the optionsContainer and showing the resetGameBtn, not the other way around.

Yes I have corrected myself but still didn’t work

Can you share your updated code please?

EDIT: It looks like you have more than one topic open for this issue. Please only open one topic per issue. I’ll merge them now.

/*

function showResults(userOption)
if (playerScore === 3) {
winnerMsgElement.innerText = “player has won the game!”;
resetGameBtn.style.display = “block”;
optionsContainer = “none”;
}
else if (computerScore === 3) {
winnerMsgElement.innerText = “computer has won the game!”;
resetGameBtn.style.display = “block”;
optionsContainer.style.display = “none”;
}

};

// User Editable Region

As has been said a few times, you need to update the text of the winnerMsgElement correctly, including capitalisation, so that it matches the requirements.

Also, as I said, you have removed pre-existing code from the function, which is necessary for the function to work correctly.

Finally, ensure that you are accessing the style.display property each time you wish to update the visibility of the resetGameBtn and optionsContainer elements.

Please see my original post above.

Thanks so much.. my mistake was the capitalization.. now I pass the code.. thanks for your assistance..

1 Like