Why doesn't this code produce 'scissors' in the console?

https://www.codecademy.com/courses/introduction-to-javascript/projects/rock-paper-scissors-javascript

const getUserChoice = userInput => {

userInput = userInput.toLowerCase();

if (userInput = ‘rock’) {

return userInput;

} else if (userInput = ‘scissors’) {

return userInput;

} else if (userInput = ‘paper’) {

return userInput;

} else {

console.log(‘Please enter “Rock” Paper" or Scissors".’);

}

}

console.log(getUserChoice(‘scissors’));

1 Like

= is an assignment, not an evaluation. You need === instead.

1 Like

In your if statements you are assigning the value to the variable because you are only using = . You need to use three equal signs to compare both variables (===)

Example

if (userInput ===  'rock')
1 Like

Ohhhhh!! Right, thank you both so much!