11. And


#1

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

Someone help me I'm stuck here's my code
I don't know what wrong it says:

Oops, try again. Did you declare a variable called foodHere?


#2

inside the function it should be foodhere not foodHere

and here

if (hungry && foodHere === true && true) //wrong

you could simply check

if (hungry && foodhere)

or

if (hungry===true && foodhere===true)


#3

Thanks. I solved it.


#4

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