Calling a function


#1

// Write your foodDemand function below.
// Last hint: In your reusable block of code, end each line
// with a semicolon (:wink:
var foodDemand = function(chicken) {
foodDemand("chicken");
console.log("I want to eat" + " " + food );
foodDemand("Chicken");
}

It keeps saying that it looks like I didn't print anything to the console, but I have console.log right there! Please help! Also, what the heck does "calling" a function mean?


#2

Also, what the heck does "calling" a function mean?

This:

foodDemand("chicken");

So why is it complaining about not calling the function if there are 2 function calls in your function?

Well because they are in your function! And the function only runs if there is a triggering signal from outside of it. Also be careful with calling your function inside itself unless you know what you're doing because this might end up in something similar to an infinite loop.