More on control Flow(First logic operator)


#1

// Declare your variables here!
var hungry = true
var foodHere = true

var eat = function() {
// Add your if/else statement here!
if (eat) {
return true
}
else {
return false
}
};
eat(hungry&&foodHere);

When i try the code i get "It looks like your function doesn't return false when hungry is false.", i have also tried changing hungry to false and to no surprise it didn't have any meaningful effect. Am i missing something or is it just wrong ?


#2

Hi here

var eat = function() {
// Add your if/else statement here!
if (eat) {
return true
}
else {
return false
}
};
eat(hungry&&foodHere);

This part hungry&&foodHere should be inside the if condition

if (condition) {

}

And when you call the eat function you don't need to put anything inside just call it like that

eat();