Stuck on 7. What if the choice1 is paper?


#1

I've tried looking through the other threads, but can't seem to find the mistake(s) myself. If someone with more experience could please review my work point out my mistake(s) I'd really appreciate it! Thanks!


#2

HI you didn't close the first else if statement

else if (choice === "rock") {
   #here put the else and if statement
}

#3

Thanks so much! Feel so silly for missing it now.


#4

Hello, I am also having problem with my code. It show an " Syntaxerror: Unexpected token else".
I can't figure out what the problem is!

I really appreciate some help!

Thanks...

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

        };  
};

#5

HI you should remove the ; at all your closing } inside the compare function then you have more } than you need at the end remove one.


#6

Solved.. lesson learnd!

Thanks Wizmarco


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.