What am I doing wrong?


#1


https://www.codecademy.com/courses/javascript-beginner-en-Bthev-mskY8/1/2?curriculum_id=506324b3a7dffd00020bf661#


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


#2

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


#3

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:


#4

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