Writes Syntax Error: Unexpected token else
you only need two closing brackets at the end.
There is no closing curly brace for the else if(choice1==="rock").
Why are need there two extra curly braces, I do not understand
There is a closing bracket
You need a closing bracket before the second "else if"
@biff75 is correct you need two closing curly brackets after this line,
return "paper wins";
and two closing curly brackets after this line,
return "scissors wins";
it would be a lot easier to make corrections to the code if it had been copied and pasted. Screenshots make it a little harder.
So, on line 16 of @webhero 's code, line 16 has the curly brace for the
else if. Line 17 has the curly brace for the
if. Line 19 has the closing brace for the
if. Line 20 has the opening brace for the
else. Line 22 has the closing brace for the
Where is the closing brace for the
else if on line 16? You have a brace on line 30 which closes your
else if from line 23. It's the exact same syntax. I'm guessing you erased it by error when putting together your
else if for choice === paper.
Thank you for the detailed answer!
I really missed the closing curly brace for the first else if...
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.