Syntax Error JavaScript

Can anyone figure this syntax error out?

const getUserChoice = (userInput) => {

userInput = userInput.toLowerCase();

if (userInput === 'rock ’ || userInput === ‘paper’ || userInput === ‘scissors’) {

return userInput;

} else {

console.log('Error');

}

};

const getComputerChoice = () => {

const randomNumber = Math.floor(Math.random() * 3);

switch (randomNumber) {

case 0:

return ‘rock’;

break

case 1:

return ‘paper’;

break

case 2:

return ‘scissors’;

break

}

};

const determineWinner = (userChoice, computerChoice) => {

if (userChoice === computerChoice) {

return 'Tie';

}

if (userChoice === ‘rock’) {

if (computerChoice === ‘paper’) {

return 'computer won';

} else {

return 'you win';

}

}

if (userChoice === ‘paper’) {

if (computerChoice === 'scissors') {

  return 'computer won';

} else {

  return 'you win'; 

}

}

if (userChoice === ‘scissors’) {

if (computerChoice === 'rock') {

return 'computer won'; 

} else {

  return 'you win';

}

};

const playGame = () => {

const userChoice = getUserChoice(‘rock’);

const computerChoice = getComputerChoice();

console.log(userChoice);

console.log(computerChoice);

console.log(determineWinner(userChoice, computerChoice));

};

playGame()

Hi! Welcome to the forums :slight_smile:

Remember to press </> before pasting so that your code comes out formatted (it’s really hard to fix syntax otherwise).

@kbgratto

Code Blocks

Toolbar Icon
Using Preformatted Text icon on the toolbar

This will automatically create a code block which you can paste your code in.
capture_r
Or select your code and then press the icon.

For more on how to format: How do I format code in my posts?

It says });

<const getUserChoice = (userInput) => {
userInput = userInput.toLowerCase();
if (userInput === 'rock ’ || userInput === ‘paper’ || userInput === ‘scissors’) {
return userInput;
} else {
console.log(‘Error’);
}
};

const getComputerChoice = () => {
const randomNumber = Math.floor(Math.random() * 3);
switch (randomNumber) {
case 0:
return ‘rock’;
break
case 1:
return ‘paper’;
break
case 2:
return ‘scissors’;
break
}
};

const determineWinner = (userChoice, computerChoice) => {
if (userChoice === computerChoice) {
return ‘Tie’;
}
if (userChoice === ‘rock’) {
if (computerChoice === ‘paper’) {
return ‘computer won’;
} else {
return ‘you win’;
}
}
if (userChoice === ‘paper’) {
if (computerChoice === ‘scissors’) {
return ‘computer won’;
} else {
return ‘you win’;
}
}
if (userChoice === ‘scissors’) {
if (computerChoice === ‘rock’) {
return ‘computer won’;
} else {
return ‘you win’;
}
};

const playGame = () => {
const userChoice = getUserChoice(‘rock’);
const computerChoice = getComputerChoice();
console.log(userChoice);
console.log(computerChoice);
console.log(determineWinner(userChoice, computerChoice));
};

playGame()
/>

Did you find a solution?

const getUserChoice = (userInput) => { 
  userInput = userInput.toLowerCase(); 
  if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') {
    return userInput;
  } else {
    return ('Error');
  }
};



const getComputerChoice = () => {
 const randomNumber = Math.floor(Math.random() * 3);
 switch (randomNumber) {
 case 0:
 return 'rock';
 break
 case 1:
 return 'paper';
 break
 case 2:
 return 'scissors';
 break
 }
};

const determineWinner = (userChoice, computerChoice) => {
  if (userChoice === computerChoice) {
    return 'Tie';
    }
  if (userChoice === 'rock') {
   if (computerChoice === 'paper') {
    return 'computer won';
    } else {
    return 'you win';
    }
  } 
  if (userChoice === 'paper') {
    if (computerChoice === 'scissors') {
      return 'computer won';
    } else {
      return 'you win'; 
    }
  } 
  if (userChoice === 'scissors') {
    if (computerChoice === 'rock') {
    return 'computer won'; 
    } else {
      return 'you win';
    }
  }
}


const playGame = () => {
  const userChoice = getUserChoice('rock');
  const computerChoice = getComputerChoice();
  console.log(userChoice);
  console.log(computerChoice);
  console.log(determineWinner(userChoice, computerChoice));
};

playGame()