Rock, paper, scissors help

Hi! I am currently doing the rock, paper, scissors project on the javascript video game dev topic and I have hit a roadblock. I have finished the code but it keeps outputting this error:

/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/rockPaperScissors.js:67
});
^
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 have cmd + f these keys and cannot find this syntax error ANYWHERE in the code. I started this career path a few days ago so I am very new to it so sorry if this is a dumb question, I am at a loss.
The code:

const getUserChoice = userInput => { userInput.toLowerCase(); if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') { return userInput; } else { console.log('Must use rock, paper, or scissors'); } } const getComputerChoice = () => { const randomNumber = Math.floor(Math.random() * 3) switch (randomNumber) { case 0: return 'paper' case 1: return 'rock' case 2: return 'scissors' }; }; const determineWinner = (userChoice, computerChoice) => { if (userChoice === computerChoice) { return 'You tied!'; }; if (userChoice === 'paper') { if (computerChoice === 'scissors') { return 'The computer won!'; } else { return 'You won!'; } }; if (userChoice === 'rock') { if (computerChoice === 'paper') { return 'The computer won!'; } else { return 'You won!'; } }; if (userChoice === 'scissors') { if (computerChoice === 'rock') { return 'The computer won!'; } else { return 'You won!'; } }; console.log(determineWinner('scissors', 'rock')); const playGame = () => { const userChoice = getUserChoice('scissors' || 'paper' || 'scissors'); const computerChoice = getComputerChoice(); console.log('You threw: ' + userChoice); console.log('The computer threw: ' + computerChoice); console.log(determineWinner(userChoice, computerChoice)); } playGame();

omg i found it. I WAS LEAVING OFF A BRACKET!!! AHHH!!!

1 Like

Haha, great job getting it fixed! As with most things with coding it’s simply a case of the more debugging you do, the better you get at it so consider it a good learning experiance! :grinning_face_with_smiling_eyes:

1 Like