Rock, Paper, or Scissors always ends up a Tie. Why?

Hello, So this is the problem. No matter what its always a tie. I switch the ‘===’ to ‘=’ it says you won all the time. Have I missed something? Followed the walkthrough and still shows up the same with it always being one way. Condense the code still no change. Added link at the bottom after the code.

const determineWinner = (userChoice, computerChoice) => {
if (userChoice === computerChoice){
return ‘Tie’
}
if (userChoice === ‘rock’ && computerChoice === ‘paper’) {
return ‘You lost’
} else{
return ‘You won’
}
if (userChoice === ‘paper’ && computerChoice === ‘scissors’) {
return ‘You lost’
} else{
return ‘You won’
}
if (userChoice === ‘scissors’ && computerChoice ===‘rock’) {
return ‘You lost’
} else{
return ‘You won’
}
}

Any reason why this is like…this?

You’re determineWinner() function takes two arguments in to work. Check through to make sure you have entered two arguments whenever it is called.

1 Like

Thanks, looks like that fixed it. Forgot about the parameters. Then reintroduced the embedded ‘if’. Due ‘&&’ does not work in this case. Thanks again.

1 Like