Scissors, Paper, Rock - Syntax Issue


I’m currently returning a syntax error for the below code snippet. The error being returned is:

return: ‘rock’;
SyntaxError: Unexpected token :

const getUserChoice = (userInput) => { userInput = userInput.toLowerCase();
  if (userInput === 'rock' || userInput === 'scissors' || userInput === 'paper') {
    return userInput;
  } else {

const getComputerChoice = () => {
  const randomNumber = Math.floor(Math.random() * 3);
  switch (randomNumber) {
    case 0:
      return: 'rock';
    case 1: 
      return: 'scissors';
    case 2:
      return: 'paper';

Here’s a link to the current project I’m working on:

I’ve followed the walkthrough exactly and cant’ see where I’m messing this up. Any advice would be greatly appreciated!


return doesn’t need a :

simply return ‘rock’ etc.

1 Like

Thanks so much! Perfect!

Yes, you are very welcome. But for future troubleshooting I suggest to you to read the error message thoroughly and draw conclusions on that. All the information is there.

js:13 means in the 13th line of code of the js file

return: 'rock' is the snippet of code where it encounters a syntax error

And the SyntaxError it returns is that is found a token “:” it did not expect being there.

1 Like

Haha, nice one. I definitely didn’t read that thoroughly enough. Thanks so much for the pointers.