Rock paper scissors annoyance

Can anyone let me know if I have a syntax error because I’m getting a syntax error message and I can’t find any errors. Here’s the code

console.log(“hi”);
const getUserChoice = (userInput) => {
userInput = userInput.toLowerCase();
if (
userInput === “rock” ||
userInput === “paper” ||
userInput === “scisscors”
) {
return userInput;
} else {
console.log(‘Error!’);
};
};

const getComputerChoice = () => {
var randomnumber = Math.floor(Math.random() * 3);

switch (randomNumber) {
case 0:
return ‘rock’
break;
case 1:
return ‘paper’
break;
case 2:
return ‘scissors’
break;
};

Hi and welcome to the amazing community of CodeCademy!

There is an error in the code: the variable “randomnumber” was declared with a lowercase “n”, but then it is used with an uppercase “N” in the switch statement. You should correct this error by writing the variable name correctly wherever it is used.

Additionally, there is a typo in the word “scissors” in the if statement condition in the getUserChoice function.

Finally, there is a missing closing curly brace for the else statement in the getUserChoice function.

1 Like