Rock Paper Scissors problem java script

Hello! it seems that there is a problem with my Rock, Paper, Scissors! game code.

Here is the code i’ve made. I already counted the courlybraces and i dont know what else to do.
Here is the code:

const getUserChoice = userInput => {

  userInput.toLowerCase() 

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

    return userInput;

  } else {

    return console.log('Error')

  }

}

function getComputerChoice () {

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

  switch (randomNumber) {

    case 0:

     return 'rock';

     break;

    case 1:

     return 'paper';

     break;

    case 2: 

     return 'scissors';

     break;

  }

} 

function determineWinner(userChoice, computerChoice) {

  if(userChoice === computerChoice) {

    return 'Tied Game!';

  } else {

    if (userChoice === 'rock'){

      if (computerChoice === 'paper'){

        return 'Looser!';

      } else {

        return 'Winner!'

      }

    }

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

      if (computerChoice === 'scissors'){

        return 'Looser!';

      } else {

        return 'Winner1';

      }

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

    if (computerChoice === 'rock') {

      return 'Looser!';

    }else {

      return 'Winner!'

    }

  }

and this is the error message:

/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/rockPaperScissors.js:55
});
^
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)

can somebody help me? i cannot find the roblem!! :(((((

Hi @arcace40218
I find the error messages you get in codecademy a little unspecific sometimes. Pasting the code into another editor often helps. For example here:
https://jsfiddle.net/
It logs
Uncaught SyntaxError: Unexpected end of input
for your function determineWinner
Check if each opening curly bracket has a closing counterpart.

1 Like

thanks!! doing that i solved it!!!

1 Like

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