11 I am not sure what I am doing wrong


#1

From what I can tell I have this written out properly but I cannot find the fault in my syntax,

var hungry = true;
var foodHere = true;

var eat = function() {
  if(hungry && foodHere){
      console.log("this is good");
  }
  else if(!(hungry || foodHere))  {
      console.log("I should only see this if I made a mistake");
  }  
  else {
  console.log("Another line I should only see if I made a mistake");
  
  }
}

it just prompts me saying it does not return false when hungry is false please help me


#2

At least set up a condition that produces this result, no matter how ugly.


#3

I found out hat it is simply because we should return instead of console.log.


#4

I'm also having a problem with this. I keep getting this error

It looks like your function doesn't return false when hungry is false.

Here's my code.

var hungry = true;
var foodHere = true;

var eat = function() {

  if (hungry && foodHere){
      console.log("Let's Eat!");
  }
  else{
      console.log("Let's Go Elsewhere");
  }
};

#5

mihaela_fodor is correct the question is asking us to return true of return false. Do not use console.log

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

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

#6

Thanks everyone that is helpful