5/9 Syntax error


#1

/*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(choise1, choise2) {
if (choice1 === choice2) {
return "The result is a tie!";
}
};

It keeps saying "Oops, try again. Did you create a function called compare?"
Please help :frowning:


#2

You named you parameters choi s e instead of choi c e so the function is not working correct and so the interpreter assumes that there is no function. Which is wrong as there obviously is one.


#3

Thank you so much! I didn't notice that at all.


#4

Hi everyone,
I'm not too sure what is wrong with this code. I think this is correct

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

This is the error I am getting: Oops, try again. Your compare function does not return 'The result is a tie!' when there is a tie.

Can you help as I can't go further :smile:


#5

Seems like your missing a "!" at the end of your sentence.


#6

oh I see. Thanks so much. Well spotted :joy::joy::joy::joy: