What's wrong with my conditionals' syntax?


var player1 = prompt("Rock, Paper, or Scissors?");

var compare = function(here) {
if (here === "Rock") {
return "Player 1 wins!";
else if (here === "Paper") {
return "Player 1 loses!";
else (here === "Scissors") {
return "Its a tie!";

im doing a shorter version of this rock-paper-scissors prompt, assuming that the computer will choose scissors. I can't figure out the syntax however and when I run the code, I get the error: "SyntaxError: Unexpected token {".

Please Help


I'm not sure if the exercise will allow you to make a shorter version without it throwing some reference error.

It looks like your problem is with the end of your function:

You forgot to add a semicolon.


There is a close parentheses missing here.


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