JavaScript Rock, paper, scissors error

Trying to complete my rock, paper, scissors. I feel like i have tried everything. My userChoice === rock works fine, but any other userChoice option gives me undefined. After going back it says that you will get undefined if there is no return. both options have a return. am I missing something?

looks like some of your } are in the wrong place.

In that code, you need a } to end the outer if-statement block, otherwise you’re nesting the if-statement blocks (meaning putting one inside the other).

  if (userChoice === 'rock'){
    if(computerChoice === 'paper'){
      return "Computer wins";
    else {
      return "Player wins";
  } // <- your code was missing this
  if (userChoice === 'paper'){

thank you so much! that definitely fixed the issue.