Need help.. cant proceed.. Unexpected end of input


I keep getting the "Unexpected end of input" error

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";


HI you should add one } at the end for closing the compare function


It worked. Thank you. Why do you need 3 of those to end it though? so it looks like this

I was only doing two because I thought one was to finish the return, and the other was to finish the compare function. Why are there three? If you could explain it to me I would really appreciate it


The first one close the else statement the second the else if statement and the last one the compare function so it's like that

var compare = function(choice1, choice2) {
    else if (condition) {
        if (condition) {
        }/*close the if statement*/
        else {

       }/*close the else statement*/
    } /*close the else if statement*/

} /*close the compate function*/


thank you so much for your help