Rock paper Scissors


#1

Error says "Oops, try again. Did you create a function called compare?"

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

};


#2

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

};

I think it's fixed, I'm not positive.
Could someone confirm this for me/us?


#3

in the if statement my choice2 is capitalized. if (choice1 === Choice2)


#4

Now the error says "Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie."


#5

try that it work you just forgot the ! at the end the return statement it should be like that

var compare = function(choice1, choice2){ 
    if (choice1 === choice2){
        return "The result is a tie!";
}

};

#6

but in the instructions there isn't a "!" ??


#7

sorry the hint didn't show the ! but when I added the ! it worked. Thank you :slightly_smiling: