What am I doing wrong?


#1

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


#2

Hey @codekses,

In foodDemand, it would be easier to put your parameter as food, not pizza. I'll tell you why. :wink:

I'm guessing that you want your foodDemand to be pizza, right? Which is what this is for:

foodDemand();

and you would change that to:

foodDemand(pizza);

For pizza would then be your parameter, in your case pizza.

Which is confusing.

Much easier like this:

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

(Oh yeah, just in case you just copy + paste this code, I made a bit of not having the perfect statement there. It's called copyproof. :wink:)

What this does is that it makes pizza the property for the parameter food, not pizza being the property for the parameter pizza.


Okay, now the REAL problem

The real problem in your situation is that you don't have any value for the parameter pizza.

As said on top, should be like:

foodDemand(8);

Hope it helped!:smiley:


#3

Thanks man!