Error:access is denied,why is it?


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


comment-out the call of the compare-function
// compare(userChoice, computerChoice)
as it might be it frustrates the code-checker.

Do not use a semi-colon-; on the IF ELSE-IF statement structure
== ==

every return-statement line should end with a semi-colon-;
as it is the End-of-Statement indicator

every var statement should end with a semi-colon-;
var compare = function(choice1.choice2) { };

Your access problem could have been temporary
as the site will have been bombarded with logon-requests
after the October-Newsletter was distributed....
I Iost connection, working from the Netherlands.

Concerning the execution of your compare =function=
please read


Thanks you so much!it works already!Thanks!!


but you did look at =6b link
as you are using the return-statement, you will get a result with NO-Display....

console.log( compare(userChoice,computerChoice) );


but it displays the result, for example I copied pasted this:
Computer: paper
paper wins
,may I know why is it so, even without the console.log?


The Display is the result of the checks by the code-checker software.
At the END of your code add a code-line
console.log("== This my END ==");
every output coming after that will be the code-checker.