"And" logical operator .! Spot the mistake please


#1

// Declare your variables here!

var hungry = true;
var foodHere = true;

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

  else {
      return "You only like one";
      }

};


#2

What behaviour are you looking to change? What does it do now that you don't like, what should it do instead? What are we looking for?

PS your post would look much more tidy if you made sure that the formatting of your code was intact, now it looks kind of sloppy and it's harder to read as well.


#3

I made it simpler and it works:

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

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


#4

i tried and it didnt work for me but this one did

var hungry = true;
var foodHere = true;

var eat = function() {

if (hungry&&foodHere){
return true;
}
else{
return false;
}
};