Logical operator AND


var hungry = (true);
var foodHere = (true);

var eat = function() {
    if (hungry && foodHere) {
        console.log("Hungry, food here")
    } else {
        console.log("Not hungry, no food here")

what's wrong with this code, I keep getting this message:
Oops, try again. It looks like your function doesn't return false when hungry is false.


The exercise is asking you to return true or return false depending on the situation. You have not specified any return values but have instead logged some messages to the console.

Do you see how you can fix that now?


thank you, i've got it know :grinning:


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