Ergh. again?


#1


it's saying i didn't declare the var hungry? but it's right there? i already reset code, browser, but i'm not sure if i should go ahead and do computer? maybe i'm just doing something wrong.


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


#2

i took out the = true; and =false; because it still said i didn't declare var hungry.


#3

here

if (hungry && foodHere = true) {

remove = true
it should be

if (hungry && foodHere) {

and read the instruction again

Create two variables, hungry and foodHere, and set them both equal to true

so both should be equal to true


#5

Like rcodeman said, if you declare your variable outside the function, then you will not have to declare it again inside of the function. However, for your original code to work then you must use triple ===
Example: if (hungry && foodHere === true) {


#6

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