Rock, paper... Help

I cannot find where I have created a syntax error. Here is my code;

const getUserChoice = userInput =>
{ userInput = userInput.toLowerCase();
if (userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’) {
return userInput;
} else {
console.log(‘Error!’);
}
}
const getComputerChoice = computerInput =>
{ const randomNumber = Math.floor(Math.random() * 3);
switch(randomNumber) {
case 0:
return ‘rock’;
case 1:
return ‘paper’;
case 2:
return ‘scissors’;
}
}
const determineWinner = (userChoice, computerChoice) => {
if(userChoice === computerChoice) {
return ‘The game is a tie!’;
}
if(userChoice === ‘rock’) {
if(computerChoice === ‘paper’) {
return ‘The computer won!’;
} else {
return ‘You won!’;
}
}
if(userChoice === ‘paper’) {
if(computerChoice === ‘scissors’) {
return ‘The computer won!’;
} else {
return ‘You won!’;
}
}
if(userChoice === ‘scissors’) {
if(computerChoice === ‘rock’) {
return ‘The computer won!’;
} else {
return ‘You won!’;
}
}
const playGame =() => {
const userChoice = getUserChoice(‘scissors’);
const computerChoice = getComputerChoice();
console.log(‘You threw:’ + userChoice);
console.log(‘The computer threw:’ + computerChoice);
console.log(determineWinner(userChoice, computerChoice));
};

playGame();

Singed, Newbie

Hello @jjl010, welcome to the forums! What error are you getting?

I think that is just due to the forums auto-smart quotation mark formatting. Notice the difference in font and size between your code and the OP’s code.

You are missing a curly bracket. This line doesn’t have a closing counterpart.

const determineWinner = (userChoice, computerChoice) => {

Once done, you don’t get any syntax errors anymore.

1 Like

SyntaxError: Unexpected token )

Thank you! I appreciate the extra eyes.