Rock, Paper and scissors game unexpected error

Here is the link of my Code… please reply what’s the mistake I have been making.
Thanks for your feedback. :slightly_smiling_face: :slightly_smiling_face:

Hi! Thanks for sharing your code and welcome to the forums :slight_smile:

What is the error the console is giving you?


Welcome to the forums!

Can you tell us what the “unexpected error” you’re seeing is? :slight_smile:

Edit: Darn it @toastedpitabread, you and your speedy typing! :stuck_out_tongue:


I’m just quick to not understand :rofl: :rofl:

I have checked the 4 to 5 time but can’t figure out what’s wrong

1 Like

That error is a syntax error message, meaning that you’re probably missing a curly brace. (I have issues with the fact it doesn’t give you the proper line but that’s another story).

For me personally: having a good practice of indentation can help weed these errors out before they start appearing everywhere. I’ve re-indented some of your code where I think the error was, see if you can spot it.

const getUserChoice = userInput => {
    userInput = userInput.toLowerCase();
    if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') {
        return userInput;
        } else if (userInput==='bomb') {
             console.log('Great choice! You can destroy everything. You have won the game.');
        } else {
             console.log(`Your choice as ${userInput} is invalid`);

//const getComputerChoice  etc
1 Like

Thanks for the help. I acknowledge your valuable advice. :slightly_smiling_face: :+1:

1 Like