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

Tell us what’s happening:

Task is to create showResults function.What is wrong?

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");

function showResults(userOption) {
  playerScoreSpanElement=`${playerScore}`;
  computerScoreSpanElement=`${computerScore}`;


};

showResults("Rock");

// 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/132.0.0.0 Safari/537.36 Edg/132.0.0.0

Challenge Information:

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

Hi. Look at the instructions. The HTML elements should be updated to show the updated scores. Your function doesn’t do this. The getRoundResults function updates the score.

Look at the 2nd tip to show how your function can do this.
You also haven’t updated the roundResultsMsg with the result of the round.

Note the first tip - you need to use the innerText property on your html elements represented by your variables to update the HTML.

Hello, I hope you have already solved it, however I would like to leave the solution here, so others can understand. Since perhaps the order of the statement can be confusing.

and the error of updating the variables is due to the fact that we must first call the function that has the scores updated, which is getRoundResults. Once we have that line we can update, otherwise we would be calling the results of the scores that are initialized to 0.