11/14 Did you declare a variable called hungry?


I don't know what's wrong with this


if (foodHere=true&&hungry=true){

should read,

if (foodHere === true && hungry === true){

or more simply,

if (foodHere && hungry){


but why i can declare variable by using =,but i can't use =in the "if"conditoin?


Because = is only for assignment, not comparison. For that we need ===, or some truthy expression. Since foodHere and hungry are both Boolean, they are valid expressions.


i got that~thank you for your help