Help needed for 8.What if choice1 is scissors?


#1

Hi Guys i have just been finishing of my rock, paper, scissors activity i never got around to finish but i have just finished it off today but i ran into a problem its probably a small complication. Here's my script.

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 would really appreciate the help :smiley: .

The error message:

SyntaxError: Unexpected token else.

This is why i prefer to use case statement for long if/else statements.


#2

Remove the leading curly brace; it is closing your if statement, making this else unexpected.


#3

Thanks for the reply but i fixed it just now and finished it. how do i close the post?


#4