JS Syntax Error - No idea as to how to identify the syntax error or what it is?

const getUserChoice = userInput => {

userInput = userInput.toLowerCase();

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

return userInput;

}

else {console.log(‘Error message.’)};

};

const getComputerChoice = () => {

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 "Game was a tie";

}

if(userChoice === ‘rock’) {

if (computerChoice === 'paper'){

  return "Computer has won";

}

else {

  return 'You won!';

}

}

if(userChoice === ‘paper’) {

if (computerChoice === 'scissors'){

  return "You have lost";

}

else {

  return 'Computer won!';

}

if(userChoice === ‘scissors’) {

if (computerChoice === 'paper'){

  return "you win yay";

}

else {

  return 'You loser!';

}

}

I get the following message on the compiler:

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

const getComputerChoice = () => {
…}
if(userChoice === ‘scissors’) {
if (computerChoice === ‘paper’){
return “you win yay”;
}
else {
return ‘You loser!’;
}
}

)
1 of 15
Output-only Terminal
Output:
/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/rockPaperScissors.js:50
});
^
SyntaxError: Unexpected token )
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)

Why do I get this message and how can I identify in the error message where the syntax error even is?

I changed your code a little and got this:

const getUserChoice = userInput => {

userInput = userInput.toLowerCase();

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

return userInput;

}

else {console.log('Error message.')};

const getComputerChoice = () => {

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 "Game was a tie";
}

if(userChoice === 'rock') {
}
if (computerChoice === 'paper'){

  return "Computer has won";

}

else {

  return 'You won!';

}
}

if(userChoice === 'paper') {
}
if (computerChoice === 'scissors'){

  return "You have lost";

}

else {

  return 'Computer won!';
}

if(userChoice === 'scissors') {

if (computerChoice === 'paper'){

  return "you win yay";

}

else {

  return 'You loser!';

}
}
}

Also, don’t forget to format all of your code: [How to] Format code in posts