Rock, Paper, or Scissors

Hi guys, I’m getting this error here. I’ve checked the syntax, and it seems good. However, it’s still not working. This is the “Rock, Paper, or Scissors” exercise. I hope you can help me.

Have a look at this post:

With the above in mind, valid syntax would be:

return (computerChoice === "paper") ? "Computer won!" : "User won!"
3 Likes

You’ve address two possible states; the selections are the same or userChoice === "Rock". What if neither of those are true?

If your function returns a string, then there should be no evaluation path where it does not return a string.

Also note, rather than test ? return "foo" : return "bar";, prefer return test ? "foo" : "bar";.