Global variables not working?


The error code keeps telling me that I don't have a variable called hungry declared, but as far as I can tell, I do. What am I missing?

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

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


Be sure to use the comparison operator, ===.

Is this the one that one set to true and the other false? That one uses an OR operator if I recall.


Ah, that fixed it. Thanks!

And no. That's the next exercise.


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