7/9 please help


#1

I've looked at numerous tutorial and still I can figure this out! Here is my code:

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")}
}

//Please help!


#2

This is a fact you must know. It's like the #1 fact.
YOU MUST NOT PUT A SEMI COLON AFTER THE IF STATEMENT

See those semi colons? You have take all the semi colons that are located in that area out.


#3

Also, add another bracket at the end.


#4

I still get an unexpected else token


#5

Did you put a bracket at the end? Because you know, I copied yours and edited it. It worked for me.


#6

Yeah i did everything but it still didnt work but ill try again


#7

It works now thank you so much


#8

I have one more code problem:

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")
}
}
}

I'm not sure what I did wrong


#9

Haha back to square one... What's the #1 rule?!

You got a semi colon hidden somewhere...


#10

no semicolons on if/ if else staements


#11

Includes else if statements too.


#12

found it! thanks again, i really needed help