7/9 Help!


#1



I am stuck at 7/9


I do not have any error messages the problem is that even when it says in green "Move on!" once i press save and submit and I type in "rock" it shows on the console "computer : rock" it doesn't even show that it is a tie even if I did the tie exercise earlier, please help, I want to learn to code not just skip stuff cause there is a bug in the system.

My code :


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


#2

HI you should call the function compare like that

compare(userChoice, computerChoice);

#3

Didn't do anything, but thanks anyways!


#4

But when I add it it show up

I also added this

console.log("userChoice: " + userChoice)

to show the userChoice


#5

That works, thank you very much!