Food Variables


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/0/4?curriculum_id=506324b3a7dffd00020bf661

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?

Thanks,
-AmericanX


var foodDemand = function(food);
{

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

};


#2

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:


#3

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


#4

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) {
`


#5

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