Multiple 'or' '||' comparisons - false vs true in Rock, Paper, or Scissors

I’m working through the ‘or’ conditions of the Rock, Paper, or Scissors program.

Step 3:
When getting the user’s choice, you should also check to make sure that the user typed a valid choice: ‘rock’, ‘paper’, or ‘scissors’.
Inside getUserChoice() , write an if / else statement that makes sure the userInput is either 'rock' , 'paper' , or 'scissors' . If it does, then return the userInput . If not, use console.log to print an error message to the console.

My code works when using a single ‘!==’, but does not work when using multiple ‘||’ and ‘!==’ conditions and I would like to know why. My code:
if (userInput !== ‘rock’ || userInput !== ‘paper’ || userInput !=== ‘scissors’) {
console.log(‘error: invalid input’);
} else {
return userInput;
}

‘Correct’ code:
if (userInput === ‘rock’ || userInput === ‘paper’ || … ) {
return userInput;
} else {
console.log(‘Error!’);
}

Hi @ir8n8 ,
if you do it the reverse way (checking if your condition DOESN’T match instead of checking a match), you have to use ‘and’ instead of ‘or’:

if (userChoice !== 'paper' && userChoice !== 'scissors' && userChoice !=='rock')

Because in case the first condition already returns true (if userChoice is paper, the first condition evaluates true), the other conditions aren’t checked. True is returnd for at least one match. That means, the function (console.log) is called, even if userChoice is a valid entry like ‘rock’ or ‘scissores’.