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

Tell us what’s happening:

Hello,

This is my code:

playerScoreSpanElement.innerText = playerScore;
computerScoreSpanElement.innerText = computerScore;

const resultMessage = getRoundResults(playerChoice, computerChoice);
roundResultsMsg.innerText = resultMessage;

I am not sure where I am going wrong.

Is someone able to help or guide me to answer this solution?

Thanking you.

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;
    
    const resultMessage = getRoundResults(playerChoice, computerChoice);
    roundResultsMsg.innerText = resultMessage;
};

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

Challenge Information:

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

Hi there!

Remove the unnecessary parameters from the function above.
Edit: also the roundResultsMsg should be assigned before the player and computer score is updated.

Hi thanks for your reply.

I am still not sure what you mean. Are you able to explain further what you mean?

Thanking you

I said you need to update roundReslutsMsg before the playerScore and computerScore updated.

Also that parameters within the getRoundResults is not defined within the function showResults. It’s have the parameter userOption, you need to use that parameter.

Hi,

I worked it out. Thanks for your help.

Cheers.

1 Like