Keep getting undefined

Hi,

I am working on the rock paper scissors exercise in the intro to javascript but keep getting “undefined” if “scissors” is the userChoice. Am I missing something blindingly obvious?

Thank you so much in advance
Sarah

const determineWinner = (userChoice,computerChoice) => {
if (userChoice === computerChoice){
return "It's a tie!"
} 
if (userChoice === 'rock'){
  if (computerChoice === 'paper'){
    return 'The computer won!';
  } else { 
    return 'You won!';
    }
}
if (userChoice === 'paper'){
  if (computerChoice === 'scissors') {
    return 'The computer won!';
  } else {
    return 'You won!';
  }
if (userChoice === 'scissors'){
  if (computerChoice === 'rock') {
    return 'The computer won!';
  } else {
    return 'You won!';
  }
}
}
}

console.log(determineWinner('scissors','rock'))```

if you get undefined, it means no return keyword has been reached.

you made a mistake in your nesting, fixing your indent(ion) should help you better understand the problem, you nested the user choice equals scissors clause within userChoice is paper choice, let me show you:

if (userChoice === 'paper'){
  // computer choice code
  if (userChoice === 'scissors'){

  }
}

Thank you very much! That is really helpful! I will focus on indenting better!