Return not showing up


No error messages, but the output doesn't show any of the return statements and only prints out what the computer has chosen.

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


You put the function call inside of the actual function... Remove it and it will run! :slight_smile:


I just deleted your prompt. It worked fine.


Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I just couldn't see, even when I was comparing to someone else's that worked. I was looking at everything except the last line location. Cheers :slight_smile:


You're welcome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:


def greater_less_equal_5(answer):
if (15>5):
return 1
elif (4<5):
return -1
return 0

print greater_less_equal_5(4)
print greater_less_equal_5(5)
print greater_less_equal_5(6)

From the about code I want to get the answer 1, -1 and 0, when I run the code I seen all my answer equal to 1's. So I need your help for the code. Thanks