Im not geting the results


#1

Code academy say i finished the course, but i aint geting the results of the match. Could anyone help me out?

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(computerChoice,userChoice){
if (computerChoice === choice2){
return "The result is a tie!"
}
else if (computerChoice === "rock"){
if (userChoice === "scissors")
return "rock wins"
else (computerChoice === "paper")
return "paper wins"
}
else if (computerChoice === "paper") {
if (userChoice === "rock")
return "paper wins"
else
return "scissors wins"
}
else if (computerChoice === "scissors") {
if (userChoice === "rock")
return "rock wins"
else
return "scissors wins"
}
}


#2

That's because the code you have here is just what runs in the background. You still need to console.log the results in order to see it. Try adding this console.log at the very end of your code:

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


#3

Ah i see. it worked. thanks alot!