Kept on getting stuck on functions


#1

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!
I put this
// Write your foodDemand function below.
// Last hint: In your reusable block of code, end each line
// with a semicolon (:wink:
var Functonname = function (FoodDemand) {
console.log("I want to eat" + " " + "food");
};

var FoodDemand = Food("pizza");

but it is wrong, someone plz helpand tell me the correct answer


#2

The syntax for functions is - var functionName = function (parameter) { };

So in your case, you have FoodDemand as a parameter not the name of the function.
The correct answer would be:

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

}

You're also calling your function wrong. Should be: foodDemand("pizza");