Help - syntax error unexpected token Rock Paper Scissors

Hi there,
I’m working on the rock paper scissors project and am stuck.

Here’s what I coded:
const getUserChoice = userInput => {
userInput =
if (userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’){
return userInput;
} else {

function getComputerChoice = () => {
Math.floor(Math.Random() * 3);
switch (randomNumber) {
case 0:
return ‘rock’;
case 1:
return ‘paper’;
case 2:
return ‘scissors’;

When I try to run the code, I get this message:
/home/ccuser/workspace/javascript_101_Unit_3/Unit_3/rockPaperScissors.js:12 function getComputerChoice = ( ) => {
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)

(the error seems to be pointing to the = that’s after getComputerChoice if that helps)
I have moved past this step but as long as I can’t figure out a way to move past this error, I can’t successfully complete the game :frowning: Any ideas about what I’m doing wrong? Thank you!

That statement cannot contain a line break.

1 Like