This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by kippei_low
over 8 years

Another unexpected else question..

Even after following one of the templates I found in FAQ I still get either else or { as an unexpected token (which to me are all completely expected!) since I can’t find any answer to why my code isn’t right I hope you guys can help..

var compare = function (choice1, choice2){
if (choice1 === choice2){
    return "The result is a tie!";
}

else if(choice1 === "paper"){
    
    if(choice2 === "rock"){
        return "paper wins";
    } // close if choice2 = rock
    
    else(choice === "scissors"){
        return "scissors wins";
    } // close if choice2 = scissors
} // close else if choice 1 paper


}; // close function body

Thank you all in advance

Answer 55f457899113cb133400032a

0 votes

Permalink

An ELSE statement does NOT take a condition

Have a read through http://www.codecademy.com/forum_questions/559dcb4be39efe550f00006b and concentrate on the build of the IF ELSE-IF statement…

points
Submitted by Leon
over 8 years