# What if choice 1 is scissors? Unexpected End of Input

#1

Not sure what is the problem with my end of input but I would sure like some help to figure it out...

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

#2

var compare = function(choice1, choice2) {

the opening curly bracket ({) of your function doesn't have a matching closing one, place the closing curly bracket at the right place (hint: at the very end)

#3

ok thank you! Now I get unexpected token else.... I assume it is talking about the only else by itself but I believe i need that lol

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

#4

you closed your compare function way to early, everything should be inside the compare function. Very end = end of file

#5

Thank you very much!