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

Tell us what’s happening:

I don’t know why my code is not passing through :frowning:

Your code so far

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

/* file: styles.css */

/* file: script.js */
// User Editable Region

function resetGame() {
  playerScore = 0;
  computerScore = 0;
  computerScoreSpanElement = "0";
  playerScoreSpanElement = "0";
  resetGameBtn.style.display = "none";
  optionsContainer.style.display = "block";
  roundResultsMsg = "";
  winnerMsgElement = "";
};

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) 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 6

hi there!
you have missed some of the instrutions to code:

  • You can use the innerText property to update the content of an element. To clear the content of an element, you can set the innerText to an empty string.

and aslo the instructions for span elements:

  • Updates the playerScoreSpanElement and computerScoreSpanElement to display the new scores.*

you are updated the span elements to the string, not to the score.

@hasanzaib1389
Is this what you meant?
function resetGame() {
computerScore = 0
playerScore = 0
computerScoreSpanElement = playerScore
playerScoreSpanElement = computerScore
resetGameBtn.style.display = “hidden”
optionsContainer.styles.display = “block”
winnerMsgElement = “”
roundResultMsg = “”
};

I think the issue is with the first line itself as the code does not seem to pass it. The error I am receiving is - Your resetGame function should set the playerScore to 0 .

you are not using the innerText property on above variables. if you add innerText with these variables your challenge will pass.

Tried that, but does not work. Same error again
function resetGame() {
playerScore = 0;
computerScore = 0;
computerScoreSpanElement.innerText = “0”;
playerScoreSpanElement.innerText = “0”;
resetGameBtn.style.display = “none”;
optionsContainer.style.display = “block”;
roundResultsMsg = “”;
winnerMsgElement = “”;
};

this time you changed that lines again, assign the palyer and computer scores again.

and with above variable you need innerText also.

@hasanzaib1389 - Thank you. I tried your suggestion and it worked!
function resetGame() {
playerScore = 0;
computerScore = 0;
computerScoreSpanElement.innerText = “0”;
playerScoreSpanElement.innerText = “0”;
resetGameBtn.style.display = “none”;
optionsContainer.style.display = “block”;
roundResultsMsg.innerText = “”;
winnerMsgElement.innerText = “”;
};

that is great. your welcome. but please do not post the solution code.