Hello People, I am taking a JavaScript course and I'm in quite a pickle.
I'm doing it via code academy and well there appears to be a syntax error which I can not seem to work out.
If this thread is in the wrong area, then would a moderator kindly move it to where it should be.


Code:


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


The main code which you should focus on, is the code in bold. The rest of the code is correct however when I try to run it all together, apparently "there is a syntax error". PLEASE HELP



P.s. I am making a rock, paper, scissors GAME