11. And - I don't what I am doing wrong


#1

I don't know what I am doing wrong.

var hungry = true
var foodHere = true

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

Instructions are:
Create two variables, hungry and foodHere, and set them both equal to true. Inside the eat function, create an if statement that returns true only if both hungry and foodHere are true, and false otherwise. The function eat should take no input and hungry and foodHere should both be globals.


#2

Do you need to return true and false as strings? Because you are and I don't know if they're supposed to be returned as booleans. :slight_smile:


#3

Ohhh Thank you. It was supposed to be a boolean. That was a stupid mistake.


#4

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