I really need help, I've been stuck for two days!


#1

I have no idea what is wrong with this code, it says unexpected keyword 'else' in syntax:

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

I tried switching else if(choice1==="paper") with an if then the next else with an else if, that doesn't seem to work. I've tried re arranging the brackets, that also doesn't seem to work. I have also tried putting a function infront of the last else to state that else (choice2==="scissors") { return "scissors wins" }

I need serious guidance because I haven't got a clue as to how to fix it, please help!!!


#2

Never mind, I found the solution. Thank you for coming to this post if any you have :slightly_smiling: