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

Tell us what’s happening:

Your showResults function should update the computerScoreSpanElement to show the updated score of the computer.
Please help.

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.innerText = playerScore;
  computerScoreSpanElement.innerText = computerScore;
  roundResultsMsg.innerText = getRoundResults(userOption);
};

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/133.0.0.0 Safari/537.36

Challenge Information:

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

Nevermind, i got it. I was updating the score before calling the getRoundResults() function.

2 Likes

Indeed, but no need to call it separately at first place. What can do the job is to start with the roundResultsMsg.innerText calling it in fact, then the scores update will be accepted

1 Like

Just to clarify, the order matters here, because we need to call the function first to determine the additional points, then show that information, does that sound right? (I did the same thing)