Console.log followed by return


if I use the code below, I get the following output in the console in the upper right :
get some food
get some food

I don't understand this weird order... I just expected to get once the answere "get some food" and with "return" the function would be stopped. I guess this behaviour is because of the use of console.log. Am I not allowed to combine console.log followed by return, as shown in the example below?
Thanks already in advance for helpful comments.


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

var eat = function() {
  // Add your if/else statement here!
  if (hungry && foodHere){
      console.log("get some food");
      return true;
  } else { 
      return false;



This has to do with the exercise, see what happens when you run it here, just press the run button in the top right


Thank you for the fast and helpful answer!


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