Build a Rock, Paper, Scissors Game - Step 6

Tell us what’s happening:

its seems like it work But i get a error
// running tests
2. Your getRoundResults function should return the correct message based on who wins the round. If no one wins, the message should say it’s a tie.
// tests completed
// console output
Player wins! Paper beats Rock

plz help!

Your code so far

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

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

function getRoundResults(userOption, computerResult) {
  let playerScore = document.getElementById("player-score");
  let computerScore = document.getElementById("computer-score");
  //const resultsMsg = document.getElementById("results-msg");
  let str = "";

  // Check if it's a tie
  if (userOption === computerResult) {
    return `It's a tie! Both chose ${userOption}`;
    
  }else if(hasPlayerWonTheRound(userOption, computerResult)) {
    playerScore = parseInt(playerScore.textContent) + 1;
    return `Player wins! ${userOption} beats ${computerResult}`;
    
  }else{
    // If the computer wins the round
    computerScore = parseInt(computerScore.textContent) + 1;
    return `Computer wins! ${computerResult} beats ${userOption}`;
    
  }
}

console.log(getRoundResults("Paper", "Rock") );

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0

Challenge Information:

Build a Rock, Paper, Scissors Game - Step 6

Hi. Welcome to the forum.

You haven’t updated the playerScore and computerScore variables - see lines 16 and 17 of your code.

You have introduced 2 new variables with the same name. Did the instructions ask you to getElementById?

Have a look at your hasPlayerWonTheRound function again - look at what it is doing. You need the function to check what that function returns - how do you do that in your condition? Same with the computer result.

You are not asked to update text.content.

You also deleted some of the original code given in the step, I suggest you reset to get the code back. Don’t remove any of the code given.