2/4.how does a function work?


#1

I have a problem with this section. I couldn't find out where am i wrong?

var foodDemand = function("hamburger")
{
console.log("I want to eat" + " " + "hamburger");
};


#2

Get rid of the ; after }


#3

no work, still show " There was a problem with your syntax." ooops


#4

You're already passing a value "hamburger" to the function but not making use of it by again using "hamburger" when printing the console message. I havent used JS for years but this is redundant code. Have a look at what I've just mentioned.


#5

What comes in the () of function should be a variable name. The way it gets its value is by the function call sofor it to work it should rather by something like:

var foodDemand = function(food){...};

foodDemand("hamburger");

here the value "hamburger" is assigned to the variable food so now you need to use food in your output message to display "hamburger". Is this clear?