Advanced Rock Paper Scissors

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/javascript-beginner-en-Bthev-mskY8/1/4?curriculum_id=506324b3a7dffd00020bf661

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
This might be a fairly easy question to some, but I am trying to make a Rock Paper Scissors game, and when I try to add a console.log() to the initial line, it doesn’t appear until entering the option in the prompt. Is there a way to make console.log(“Welcome to the Rock Paper Scissors game!”); before you answer the prompt?

```

console.log(“Welcome to the Rock Paper Scissors game!”);
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.”
}
}
else if(choice1 === “scissors”){
if(choice2 === “paper”){
return “Scissors wins.”
} else {
return “Rock wins.”
}
}
}
compare(userChoice,computerChoice);

<do not remove the three backticks above>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.