Food Variables


So I'm trying to do the food variable, but every time I think I have it, it says there's a problem with my syntax. ("SyntaxError: Unexpected token" is what it says in the output box.) Anybody see what the problem is with my code?


var foodDemand = function(food);

console.log("I want to eat" + " " + food "Burgers");



You are opening up your function with that curly brace, and semicolons are used as a sort of stop signal similar to periods in english. You don't want to stop your function before you define it. :slight_smile:


I'm not exactly sure what you mean. Do you mean I should open the entire code with the curly bracket? Thanks


What she means is that you can't stop a function and then open it up. ; are usually used to "end" while { means that it is just starting because you are adding new info into the { }. Basically, you need to get rid of the semi colon. May not be the best explanation but hope that helps.

var foodDemand = function(food) {


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