I dont understand whats wrong with this


#1

Replace this line with your code.

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

Please describe the problem - you say it's wrong, but in what way? What should it do differently?

Also please place your code between ```'s so it looks like a truck didn't run over it :confused:


#3

it looks good to me copy and paste your code again after refreshing the page


#4

// for trial purpose i wrote this code bt control is not going to else part n last console is also not getting printed
var compare = function(userChoice, computerChoice)
{
return ("1-userChoice is " + userChoice
+ " computerchoice is " + computerChoice);

  if(userChoice===computerChoice)
   { 
     return "The result is a tie!";
   }
else { 
      console.log("value is not same");
     }
console.log("hi");

};
compare("rock","paper");


#5

heres the code again


#7

I tried that :pensive:


#8

I've got it now... thanks guys. I was just encrypting the code outside of the first compare() function. Silly me! :joy::innocent:


#9

i copied your code and then made correction maybe i can try to fix it again
maybe check the forum


#10

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