Hi All,

I've recently been teaching myself Javascript, I came across a website codeacademy which has really helped out. Although one exercise is to create a Rock, Paper, Scissors game. I can imagine its really simple stuff but we all have to start somewhere, anyhow, I completed the exercise on codeacademy but when I copied the code into a html doc within the script tags (I also tried running the code in the Firebug console) it doesn't seem to get passed the first prompt. The prompt appears, I type in a selection i.e. rock but then the code stops there and nothing else happens

Can anyone help me with the code? Is there something missing for it not to run properly?


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


var compare = function (choice1 , choice2) {
if (choice1 === choice2) {
return "The result is a tie!";
}
if (choice1 === "rock") {
if (choice2 === "scissors") {
return "rock wins";
} else if (choice2 === "paper") {
return "paper wins";
}

if (choice1 === "paper") {
if (choice2 === "rock") {
return "paper wins";
} else if (choice2 === "scissors") {
return "scissors wins";
}
if (choice1 === "scissors") {
if (choice2 === "rock") {
return "rock wins";
} else if (choice2 === "paper") {
return "scissors wins";
}
}
}
}
};


I really appreciate your help

Cheers guys
James