What is wrong with this code?

const getUserChoice = userInput =>
userInput = userInput.toLowerCase();
if (userInput === 'rock' || userInput === 'paper' || userInput = 'scissors') 
{ return userInput;}
else {
  console.log ("Only rock, paper, scissors are valid"); }}

Maybe the two == signs missing for userInput = 'scissors

The problem, is that when a return statement is executed the function stops.

@jeanbonde4766888260 is right, userInput = 'scissors' is problematic. You use assignment here (single equal sign), which will always make this if condition evaluate to true. You should use a comparison operator

@ethanmasterprogram , I think that is within the bounds of the exercise, but it would be nice if we had the exercise url and error message for more content

1 Like

I have no explanation as to why I did not see that!!!

Thank you you so much!

Thank you!

But, the problem was with a = instead of ===

That’s it!

Thank you so much!