How does a function work?


1.Declare your function and call it foodDemand.
2.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.
3.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);
4.Call the function and put in a specific food you want!


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

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

but still it is showing "ReferenceError: Rice is not defined"


.Declare your function:

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

Call the function:

foodDemand(Rice); //it'll show "ReferenceError: Rice is not defined"

Rice should be into " " that is foodDemand("Rice")

check it


oops try again,
it is still not working, please I need help


can you please give me your updated full code?


Actually i just copy your code.i didn't notice that.

var foodDemand=function (food){  
    console.log("I want to eat"+" "+"food."); //here  write food without quotes and remove . too after food

so it should be
console.log("I want to eat"+" "+ food.);


thanks, I have gotten it.


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