Help! stuck on: more control flow in js 11. and!


#1

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

Whenever i submit the code it says "Did you declare a variable called hungry?"

var foodHere = true;
var hungry = true;

var eat = function() {
    if(hungry && foodHere = true) {
   console.log("Ok dig in!");
    }
};

#2

This part you can write just as

if(hungry && foodHere){ 
//some code
}

Because both are set value to true so the if is checking
if(true && true) which is true. No need for = true


#3

Thanks it worked! :smiley:


#4

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