'Build "Rock, Paper, Scissors" (5. Both choices are the same!)


#1

Hi I have been having trouble with my syntax, and I cannot figure out what is wrong.
This is my code...

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

If someone could please tell what is wrong, it would be much appreciated.


#2

HI try to add ! after tie like that

return "The result is a tie!";

#3

Thank you so much,
that was a stupid mistake on my part.


#4

It's ok. Everyone makes mistakes.


#5

error are come in if statment how to solve this problem.


#6

Hi you should post your code or create new topic with your code.


#7

Thanks for your help. I was stuck in the same place and the ! helped me out.


#8

i have a problem message:
Oops, try again.
Your compare function does not return 'The result is a tie!' when there is a tie.
my code is:
var compare=function(choice1,choice2){
if(choice1 === choice2){
return"the result is a tie!";
}
};


#9

Hi this

return "the result is a tie!"

should be like that

return 'The result is a tie!'

with the uppercase T


#10

Their example actually shows it without the exclamation point on the hint below.


#11

Sorry to bother everyone, but I really don't know what is wrong with my syntax:

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


#12

Try removing the space before the semi-colon and see if it works? :wink:


#13

Thank you for your reply. yeah i tried it again, there is something wrong with the semicolon. I mistakenly used ";" instead of ";"

Thanks again.
E.


#14

Aii... You're welcome.

Have fun coding! :slight_smile:


#15

Yo don't worry. The hint doesn't display the "!" either


#16

Hi. You don't need the semicolon after Return to pass. Here is mine:
var compare = function(choice1, choice2){
if (choice1 === choice2){
return "The result is a tie!"
}
};
At least there is no problem passing on my laptop.