Unexpected token Else, stuck for weeks. Syntax error,


#1

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";    
        } else(choice1 === "scissors"){
            if(choice2 === "paper"){
                return "scissors wins";
            } else{
            return "rock wins";
            }
        }
    }

function compare(userChoice, computerChoice);

#2

Hi try to close your second else if statement with } And your last else if you wrote else


#3

Tried that. Still getting unexpected token, but now its {. If someone has completed this portion and wants to copy and paste their code into the comments here I would compare and see exactly where I went wrong. I am never playing Rock, Paper, Scissors ever again after this...


#4

else(choice1 === "scissors"){

no conditions after else. Else is the default case that is run when nothing else worked so it doesn't need any specifications.


#5

Holy tap dancing jesus I am done with this. Thank you people who are smarter than me. I appreciate your help.