Please help me to solve the Javascript code I dont know where i made mistake

Please i have been dealing with this since i dont know where i made a mistake . The link to the exercise is below.

https://www.codecademy.com/paths/web-development/tracks/getting-started-with-javascript/modules/learn-javascript-functions/projects/rock-paper-scissors-javascript

This is my code.

const getUserChoice = userInput => {

  userInput = userInput.toLowerCase();

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

 return userInput;

  } else {

            console.log('Error, Please type: rock, paper or scissors');

  }

};

const getComputerChoice = () => {

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

switch (randomNumber) {

  case 0:

      return 'rock';

  case 1:

      return 'paper';

  case 2:

      return 'scissors'

}

 };

 console.log(getComputerChoice());

 console.log(getComputerChoice());

 console.log(getComputerChoice());

const determineWinner = (userChoice, computerChoice) => {

  if (userChoice === computerChoice){

  return 'This game is tied';

} 

if (userChoice === 'rock') {

  if (computerChoice === 'paper') {

    return 'Sorry computer is won!';

  } else {

    return 'Congratulation you are a winner';

  }

}

This is error message.
/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/rockPaperScissors.js:44
});
^
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)

Thanks for your helping.

I would start by fixing the indent of your code. This issue is currently hard to debug because of it.

this error is generally caused by forgetting to close something (like a function, loop or condition). And sure enough when i go stand on the opening curly bracket of your function:

const determineWinner = (userChoice, computerChoice) => {

i don’t see any matching closing curly bracket light up in the editor.

2 Likes

Thanks i have re take the exercise and pass it. no more error.