What if choice1 is a rock?


#1

ruthasiimwe11

no function on the return statement

Replace this line with your code. 

var compare = function(choice1, choice2)
{
    if(choice1 === choice2){
        return "The result is a tie!";
    }
}
if(choice1 ==="rock"){
    if(choice2 === "scissors"){
        return "rocks wins";
        }
        else(choice2 === "paper" 
        {
            return "paper wins";
        }
}


#2

The { on your eighth line is currently the end of your function. To include

if(choice1 ==="rock"){
    if(choice2 === "scissors"){
        return "rocks wins";
        }
        else(choice2 === "paper" 
        {
            return "paper wins";
        }
}

in your function, you'll need to remove the { on line eight, fix your indentation, and change if on line 9 into else if.


#3

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