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

Tell us what’s happening:

hello Campers.
I’m stuck on the last past which is " Your showResults function should update the roundResultsMsg with the result of the round." I believe the first 2 are right. its just this 3rd one that got me struck which the roundResultsMsg. Could someone please point me to the right direction on how to impliment this code.

Your code so far

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

/* 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 = getRoundResults(userOption);
  computerScoreSpanElement.innerText = getRoundResults(computerResult);
  roundResultsMsg.innerText = getRoundResults();
};

showResults("Rock");

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

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

Hello there!

try using .textContent to update the text.

hey i have tried using .textContent its still not working

Hi @BigSmoke

The code is not updating the the player or computer scores.

image

Happy coding

  • You only need to call getRoundResults one time. You use its return value for the roundResultsMsg element content. It must be passed an argument (i.e. the userOption parameter).

  • getRoundResults also causes side effects on the two variables playerScore and computerScore. So it must be called before the use of the two variables when updating the DOM.

  • The DOM elements playerScoreSpanElement and computerScoreSpanElement should be assigned the values of playerScore and computerScore, respectably (again, only after calling getRoundResults).

1 Like

Thanks that was helpful