Help! I'm stuck


#1


https://www.codecademy.com/courses/javascript-beginner-en-qDwp0/2/2?curriculum_id=506324b3a7dffd00020bf661


For some reason my code doesn't work, it keeps saying 'It looks like your function doesn't return false when hungry is false.'


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


#2

Hi! It appears that the error is in the quotation marks enclosing the true and false values. The code should work like this:

Hola! Parece que el error se encuentra en las comillas que encierran a los valores true y false. El código debería funcionar así:

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

#3

Thank you so much! I was getting frustrated!


#4

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