7. Returned paper wins instead of scissors wins


#1



I have tried many different ways but I keep getting this 'Oops, try again. Your code returned 'paper wins' instead of 'scissors wins' when the inputs are paper and scissors' please help! I have looked at many different topic things but none of them fix the problem so I don't know what to do.


var compare = function (choice1, choice2){
 if (choice1 === choice2){
  return("The result is a tie!");   
 }else if(choice1 === "rock"){
 }else if(choice1 === "scissors"){
     return("rock wins");
 }else{ 
     return("paper wins");
 }
  if(choice1 === "paper"){
 } else if(choice2 === "rocks"){
     return("paper wins");
 }else{ 
     return("scissors wins");
 }
 
}


#2

found the fix,

}else if(choice1 === "rock"){
 }else if(choice1 === "scissors"){
//should be
}else if(choice2 === "rock"){
 }else if(choice2 === "scissors"){

#3

should be,

}
else if (choice1 === 'rock') {
    if (choice2 === 'scissors') {

    } else {

   }
}

#4

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