4 Functions I'm Stuck


// Write your foodDemand function below.
// Last hint: In your reusable block of code, end each line
// with a semicolon (:wink:
var functionName = ‘foodDemand’ (‘foodDemand’); {
console.log(“I want to eat” + “Demandfood”);


i think u made a typo - you put demandFood so there will be a compilation error i think idk


Okay, so here is how it would look like:

var functionName = foodDemand (food)
console.log(“I want to eat” + " " + food);

You also had to create a parameter called food, also you don’t put markings in your var/parameters


//yeah, what it should look like is…

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


//here you set the variable to ‘foodDemand’ and a parameter called ‘food’. when you then call on the foodDemand function (in the last line) and you put any word in there it’ll use the function, so in this example if i put foodDemand(“Spaghetti”) on the last line it’ll print…

“I want to eat Spaghetti”