How does a function work? Food, please Help me


Replace this line with your code.


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

that is the syntax how should I solve this problem ? or WHat is wrong?


Functions are like memory blocks used to save a mini program inside them.

A function has an input we call parameters, the body of the function does the magic stuff, and then it outputs a result.

Functions comes with no quotes.


It's not working still could you tell me what is wrong or can someone help me because don't really understand what is wrong with it


@desiigner why is this code right because foodDeman is out of curly brackets. Can some one explain me,
THank you very much for attention


I'm a beginner myself, but I'd say the logic of functions is that only the reuseable code is within curly brackets. The brackets are for the directions, and the foodDemand is the button that executes it.


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