Need help!


#1

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

https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/0/4?curriculum_id=506324b3a7dffd00020bf661


#2

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


#3

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

This is correct?


#4

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

#5

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