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'))```