I can't find the error in my code, someone please help!


#1



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


SyntaxError: Expected '{'


Replace this line with your code. 
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

The function body is missing curly braces...

var compare =  function (choice1, choice2) {

};

Aside

Space is cheap and white space is a big help when it comes to readability and debugging. Don't be afraid to use it, especially with curly braces. At the very least, give closing braces their own line and use indentation to help visualize the nested levels.


#3

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