4. How does a function work? {STUCKED}


#1

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

Let's make a function that tells the world what you want to eat.

Declare your function and call it foodDemand.
You can call the parameter anything you like. But we'll call it food because that is the thing that is going to change each time we call the function.
Your reusable block of code follow this. Surround it with the right brackets. The code you want to repeat is: console.log("I want to eat" + " " + food);
Call the function and put in a specific food you want!


#2

Almost good but instead of this:

food("fries")

better call the function from outside of it by:

foodDemand("fries");