11. And


I've been stuck on 11. And for a few days but every time I submit my code it says Syntax Error: Unexpected Token {... Here's my code, can anyone tell me what I'm doing wrong?

var hungry = true
var foodHere = true

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


you should write like this:if(hungry&&foodHere==true) ,one equal mark means assignment,two or three equal marks means judging whever their typement or value is equal.
And you should add a parentheses after the word of funtion,as it is var eat=function(){ }


I's not the = sign that's messing it up, its a {. I have the if/else statement inside my function.


haha i was stuck because was using console.log instead of return and found your topic...
here is the working code I wrote:
var hungry = true;
var foodHere = true;
var eat = function() {
if (hungry && foodHere) {return true;}
else if (hungry || foodHere) {return false;}
else {return false;}}

which means if both are true will return true, if one is true returns false and both false returns false.