Lesson 4. How does a function work. What am I doing wrong


#1


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

What am I doing wrong? It keeps saying: "You have not called foodDemand!"
Please help.


Replace this line with your code.


#2

You need to include a function call in your code.


#3

I am completly lost, Please help with line by line assistance.

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

I cannot figure this out???

SyntaxError: Unexpected string literal "food". Expected a parameter pattern or a ')' in parameter list.


#4

String rather than argument.

Function call inside function.

Also forgot ending curly brace.


#5

I am also having trouble with this and none of these answers make anything clearer for me. Please elaborate.


#6

Hey guys, check your syntax i.e spacing, values, etc. Your code should look like this:

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

Happy coding!