Same as others, stuck on 6 with never-ending unexpected token ifs


Code is as follows:
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";


I tried comparing to the example and cannot figure out what is wrong. I had been getting unending unexpected token elses until I changed something to the hint example but not sure what and when it happened.


You seem to miss a } to close your function.


Thanks. I was looking at the example and was doing exactly what was there, but I guess it didn't account for the extra closing bracket. I had tried changing them everywhere except adding one there.