"what if choice 1 is paper" i really need help pls


#1

so this is my code and ive been stuck for hours, ill really apprectiate your 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";
}
   var compare = function (choice1, choice2) {
    if (choice1 === "paper") {
        
       return "its a tie";
    }
    else if (choice1 === "paper") {
         if (choice2 === "scissors"); 
        return "paper wins";
    }
    else {
       return "scissors wins";
}
}
};

and this is the error message
Oops, try again. Your code returned 'rock wins' instead of 'scissors wins' when the inputs are paper and scissors.


#2

The above is a comparison when it should be an assignment. Fix both instances of this error.

You have defined the compare() function twice. It should all be one function.

var compare = function (choice1, choice2) {
    if () {}
    else if () {
        if () {} else {}
    }
    else if () {
        if () {} else {}
    }
    else if () {
        if () {} else {}
    }
};

#3

I am completely stuck! It says, 'Unexpected token ILLEGAL.' Thank you in advance!

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


#5

else if () {
if () {} else {}
}

else if (choice1 === 'rock') {
    if (choice2 === 'scissors') {
        return "rock wins";
    } else {
        return "paper wins";
    }
}

#6

Now I am getting, "Unexpected token else."

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


#7

Study the pattern above, expand your code so you can see the structure and repeat the pattern in all three else if statements.