6. What if choice1 is rock?


#1



https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/2?curriculum_id=506324b3a7dffd00020bf661#


I'm overlooking a syntax error somewhere but I'm not sure where. Can anyone help?

My error message says, "Oops, try again. There was a problem with your syntax."


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


#2

Make sure you keep track of all of your "{ }". Don't use a "{" without its corresponding "}".


#3

Thanks! That helped.


#4

glad it worked out :+1:


#5

can you post your final code here?

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

}
i dont know whats my problem


#6

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

}
}