Need help!


please help me.I do not understand what should I do. :frowning:


Hi designrockstar,

It clearly says
->Declare your function and call it foodDemand.

This is how we declare a function using variables (anonymous function)

var myFunctionName = function() {


->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.

var myFunctionName = function(parameterName) {


->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);

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


->Call the function and put in a specific food you want!

myFunctionName("type any food name within these quotes")

hope that helps


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

This is correct?


var myFunctionName = function(foodDemand)  //this line defines the function
console.log("I want to eat" + foodDemand); // this is the body of the function

myFunctionName("potatoes") //make sure to call the function at last outside the function with the parameter
                                            //provided above at the time of function definition


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.