Error / Rock , papper , scissors

Can someone please help me I keep getting an error . What is wrong with my code?

You could finish that function with 3 if statements:

  • An “if” for tie

  • An “else if” with all wining options of user

  • An “else” with return for remaining choices that would be computer victories.

if (userChoice === computerChoice){ return "Tie"; } else if ((userChoice === 'rock' && computerChoice === 'scissors') || (userChoice === 'paper' && computerChoice === 'rock') || (userChoice === 'scissors' && computerChoice === 'paper')){ return "User wins" } return "Computer wins"

Please post a link to this exercise landing page. Also, please post your code as formatted text, not a screen shot.

you seem to be missing } to end some of the nested if blocks.

Which would be much more evident if it wasn’t a picture. At least with raw text I can put it in my editor and actually run it. More than we can do with a picture.

When will people realize that solving code problems is not social media? It’s hard/raw text interaction with developers.

This forum platform provides support for preformatted text in the form of code block snippets that appear as they would in one’s own code editor. Let’s have people learn how to use it and present their code so that everyone can participate, not just the few who may have the eyesight and patience to examine a picture.


:wave: Hey there!

Nice to see you in the forums, and I’m glad you got an answer to your question! Most of your fellow learners are beginners just like you, so don’t ever be afraid to make a mistake. I guarantee even our most seasoned coders started from zero and probably didn’t format their code perfectly from the get-go.

It’s true that formatting your code does make it easier to read, so here’s a handy guide on how to do just that. :smile:

I hope we continue to see you around as you continue your learning journey! Best of luck!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.