How does a function work? Food, please Help me


#1


Replace this line with your code.


#2

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

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

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


#3

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.


#5

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


#6


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


#7

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.


#8

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