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

Tell us what’s happening:

i couldnt find what is missing point that i dont see. the step is pasing the create conditions for win or not

Your code so far

/* file: script.js */
function getRandomComputerResult() {
  const options = ["Rock", "Paper", "Scissors"];
  const randomIndex = Math.floor(Math.random() * options.length);
  return options[randomIndex];
}


// User Editable Region

function hasPlayerWonTheRound(player, computer) {

  computer = getRandomComputerResult();

  if (
    (player === "Rock" && computer === "Scissors") || 
    (player === "Scissors" && computer === "Paper") || 
    (player === "Paper" && computer === "Rock")
  ) {
    return true; 
  } else {
    return false; 
  }
}



console.log(hasPlayerWonTheRound("Rock", "Scissors")); 
console.log(hasPlayerWonTheRound("Scissors", "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/128.0.0.0 Safari/537.36

Challenge Information:

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

You are overwriting the computer variable here why?

yeah i saw that after posting this :smiley: thank you !!

1 Like