8/9 Syntax error: Unexpected token. Please help!


#1

I know I'm close, but it keeps saying that I have a syntax error. Does anyone know what's wrong with my code? I'm on lesson 8.

var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} console.log("Computer: " + computerChoice);
var compare = function(choice1,choice2)
{
    if(choice1===choice2){
        return "The result is a tie!"
        }
        else if(choice1==="rock")
        {
            if(choice2==="scissors")
            {
                return "rock wins"
            }
            else
            {
               return "paper wins" 
            }
        }
        else if(choice1==="paper")
        {
            if(choice2==="rock")
            {
                return "paper wins";
            }
            else
            {
                return "scissors wins"
            }
        }
        else if(choice1==="scissors"
        {
           if(choice2==="paper")
           {
               return "scissors wins"
           }
           else
           {
               return "rock wins"
           }
        }

compare(userChoice,computerChoice);

#2

Hi @chef_carl_the_llama

Look line 39 :wink:
And close your function.

Hold on


#3

Out of sheer curiosity how can one easily find out where line 39 is? Did you count them or copy past to an editor or how do you do this. Because I'd probably be to lazy to count :smile:
Nevertheless you're correct about the missing } to close the function.


#4

Thanks so much! I was stumped.


#5

I count them, if I arrive to line 105 and I forget the number's line, I restart ... No I'm jokking :grin:
I copy past to an editor of course @haxor789 , thus I can try it to verify if it works.