Rock, Paper, Scissors Lesson 7/9 Help


#1


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


With my code, this pops up near the bottom of the screen: "Oops, try again. There was a problem with your syntax." This pops up on the "screen": "SyntaxError: Unexpected token else." Please help!


/*var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) {
	computerChoice = "rock";
} else if(computerChoice <= 0.67) {
	computerChoice = "paper";
} else {
	computerChoice = "scissors";
} console.log("Computer: " + computerChoice);*/
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";
    }
} else if (choice1 === "paper"); {
if (choice2 === "rock"); {
return "Paper wins";
} else {
    return "Scissors wins";
}
};


#2

else if (choice1 === "paper"); { // unnecassry semi-colon
if (choice2 === "rock"); { // unnecassry semi-colon

using too much semi-colons is also bad


#3

Thanks! Now it says: Unexpected end of input. :frowning:


#4

did you try trouble shooting this new problem?

your function:

var compare = function(choice1,choice2) {

there is no } to mark the end of your function


#5

Thanks! It finally worked!!!! YAY!


#6