Rock, Paper & Scissors Project - Error message

I’m trying to complete the project but I keep getting an error message.
This is my code below:
const getUserChoice = userInput => {
** userInput = userInput.toLowerCase();**
** if (userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’) {**
** return userInput;**
** } else {**
** console.log(‘Error, please type a valid input!’);**
** }**
}

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 ‘This game is a tie!’;**
** }**
** if (userChoice === ‘rock’) {**
** if (computerChoice === ‘paper’) {**
** return “Sorry, computer won!”;**
** } else {**
** return “Congratulations, you won!”;**
** }**
** }**
};

if (userChoice === ‘paper’) {
** if (computerChoice === ‘scissors’) {**
** return “Sorry, computer won!”;**
** } else {**
** return “Congratulations, you won!”;**
** }**
** }**
};

if (userChoice === ‘scissors’) {
** if (computerChoice === ‘rock’) {**
** return “Sorry, computer won!”;**
** } else {**
** return “Congratulations, you won!”;**
** }**
** };**

And this is the error message that I get:
/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/rockPaperScissors.js:42
};
*** ^***
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)***

I’ve gone over the code but I cannot seem to find where I’ve gone wrong…

You close your determineWinner() function after the first conditional branch (on line 33). Move the end of the function to the end of your code.

Your (and our) debugging process will be easier if you format your code.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.