What if choice1 is paper?


#1

why is this not working ?
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";
}
}

Can someone tell me what I did wrong and post up the FULL correct answer for this section?


#2

Hi you closed Early the else if statement

else if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock wins";
}
} <=== you should remove that 
else {
return "paper wins";
}
} <=== add one here

#3

Like this?

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

It's still not working.


#4

Do the same for the second else if statement here how it s should be

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

After going back and forth, I realized that the error came from the previous lesson. You pointed out that I had this mistake:

else if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock wins";
}
} <=== you should remove that
else {
return "paper wins";
}
} <=== add one here

Which was considered correct in the lesson before, so my coding for this lesson was wrong from the get-go... Codecademy screwed me over cause they approved one of my mistakes!