4.5 - can't get the code right!


#1


Hello!

I need some help with this exercise. I tried my version of the code, which to me seems correct, but it didn't work (my code follows below). I tried to copy paste the code in the hint, which is similar to mine, and it didn't work too. :frowning:


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


#2

Is this your full code? How it can compare choices? It's only checking if choice1 is equal to choice2. What if choice1 is "paper" and choice2 is "rock"?


#3

I believe that this is part of the final code, as in a work in progress that will result in the full code only in the end of the lesson.

This is what the instructions asked me to do. I guess for now the point is to code only the comparison in case the choices are the same.


#4

this is the print screen


#5

Ok, sorry. Next time, provide link to the lesson, please.

You have four equal signs instead of three.

 if (choice1 ==== choice2)

should be

 if (choice1 === choice2)

#6

thank you! as always, these mistakes are very stupid.

i was kind of confused on how to post here, but be sure that I'll keep that in mind next time.


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.