Logical operators


#1

what am i doing wrong? I keep getting the same message: "Oops try again. It looks like your function doesn't return false when hungry is false. Please help!!!

var hungry = true;
var foodHere = true;

var eat = function() {
if (hungry && foodHere) {
console.log("true");
}
else{
console.log("false");
}
};
eat ();


#2

@veronicarbulu,

-1
You will have to use the return statement instead of the console.log()
-2
You will have to =return= the _Boolean Value true or false
instead of your string Value "true" or "false"

-3
As the return statement will only =return= the Value with NOdisplay
you will have to call the eat =function=
like

console.log( eat() );

#3

@leonhard_wettengmx_n - Thank you very much. It did work now.