How does a function work


#1

//Hey man, Im stuck over here
//Chapter: 4. How does a function work
//here is what I have put it:

var foodDemand = function (food);

{
console.log("I want to eat" + " " + food);
}
foodDemand (burger);

//whats missing??


How does a function work?
#2

There is actually too much:

var foodDemand = function (food);

instead of the expected:

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

the interpreter finds a semicolon. So get rid of the semicolon and your function should work.

PS: Also did you define that burger variable? Or did you meant to pass the string "burger" to the function?


#3

I finally got it.
Thank you


#4