If statement inside if else statement


#1


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


Syntax error : expected ' { '

I feel like its the same as the instructions say but I guess I could use a fresh pair of eyes. Thanks


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


#3

@nicksugar1

You will need curly bracket:

var compare = function (choice1, choice2) //here you need one
    if (choice1 === choice2)
    {
        return "The result is a tie" ;
    }
    else if (choice1 === "rock")
    {
          if (choice2 === "scissors")
          {
              return "rock wins" ;
          }
          else
          {
              return "paper wins" ;
          }
    }
//here you need one too

#4

Yup just figured it out too. Thanks

Everything inside the function is code run inside { }, I see now