I dont understand whats wrong with this


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



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:


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


// 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);

     return "The result is a tie!";
else { 
      console.log("value is not same");



heres the code again


I tried that :pensive:


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


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


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