4. How does a function work?

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/4?curriculum_id=506324b3a7dffd00020bf661#

<In what way does your code behave incorrectly? Include ALL error messages.>
SyntaxError: Unexpected string
Oops, try again. There was a problem with your syntax.

```

// Write your foodDemand function below.
// Last hint: In your reusable block of code, end each line
// with a semicolon (:wink:
var foodDemand = function(“food”) {
console.log(“I want to eat” + " " + food);
foodDemand(“cake”);

<do not remove the three backticks above>

var foodDemand = function(“food”) {
console.log(“I want to eat” + " " + food);
}; //you should close the function before call it
foodDemand(“cake”);

I have done this.
var foodDemand = function(food) {
console.log(“I want to eat”"+""+food);
};
foodDemand(“chicken”);
And it says this:
SyntaxError: missing ) after argument list
Don’t know what the problem is.

You have lots of " " here this should look like


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

Thank you benjnev. I will try again tommorow.

1 Like

do like me step by step :
var foodDemand=function(Food) {
console.log(“I want to eat” + " " + Food);
};
foodDemand(“ice cream”);
and here you go !

1 Like

i check this mistake, but not clear the ERROR

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

What error message are you getting?

Thank you for the explanation!!

i have this exact thing written and i’m still getting a syntax error