What am I doing wrong?



Syntax error

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


Line 2 ....when using an if condition we don't put a semi colon ( ; )...
Line 2..... use an opening curly brace after if condition
Last line....you forgot to close the function definition ...use a closing curly brace

Done.....hope that helps


line two: remove the ( ; ) and put a {

create a new line at the end of all and put one more }, because it will close the compare function.
(On the next exercises, you will have to remove the "}"(last line i was talking about) of compare function, and put on the last line again. Have a great coding!

Hope it works. :smile:


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