Its cannot work , anybody help me plz


#1

its cannot work , anybody help me plz

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

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

I don't see any huge errors here, so more information would be helpful. What is the actual error message that appears? Could you show your indentation? Thanks!

Edit: Scissors is improperly capitalized. At post max, so I can't reply directly right now. If someone could reply to designninja for me I would greatly appreciate it!


#3

yap , here it is ,

Oops, try again. Your code returned 'paper wins' instead of 'rock wins' when the inputs are rock and scissors


#4

[quote="designninja75509, post:1, topic:60952"]
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";
}

}

};
its worked, tnx


#5

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