Overview syntax problem: And


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-qDwp0/2/2?curriculum_id=506324b3a7dffd00020bf661


Oops, try again. There was a problem with your syntax.
SyntaxError: Unexpected token else


var hungry = true;
var foodHere = true;

var eat = function() {
    if (hungry && foodHere); {
        return true;
    } else {
        return false;
    }
};


I dont know whats wrong here, can someone please help?


#2

Here:

You need to remove that semi-colon. It's acting as a suppressor there.

I hope this helps! :wink:


#3

you also don't need the else or either of the returns. just the if statement.


#4

Ahhh that works, thank you so much!


#5

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