Rock, Paper, Scissors Syntax Error

Hi, i’m having trouble with my Syntax in this lesson… Can anyone out there help?


Herm T

Hi there, welcome back to the forums! It’s been a while! :slight_smile:

Can you post the code you’re working with, and the error you’re getting when you try and run it please?

Please remember to format the code using the </> icon in the menu bar which appears at the top of the text box while you type.


Press Enter to go to a blank line, click that icon, and you will see this:


Just copy and paste your code directly from the editor into that highlighted portion so we can run it. :slight_smile:

const getUserChoice = userInput => 
 userInput = 
if (userInput === 'rock' || userInput === 'scissors' || userInput === 'paper') {
  return userInput;
} else {
  console.log('Error, please type: rock, paper or scissors.');

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

                        type or paste code here

You could comment everything out and then reintroduce it in smaller parts. And then insert things in pairs and/or run more often to see that everything’s okay so far.