Help!


#1

Does anyone know where I went wrong?
var foodDemand = function(food)
{
console.log("I want to eat" + " " + food);
foodDemand(food);
consol.log("apple");
}


#2

you put consol.log instead of console.log


#3

Oh... now its telling me I didn't print anything to the console


#4

Now switch the parameters for console.log, and foodDemand.

right now you're throwing the parameter "food" to the function and printing out something that isn't related

console.log(food);
foodDemand("apple");

#5

Do I still need the console.log("I want to eat" + " " + food); before it?


#6

Honestly yes, you don't need the second console.log however. But you do need to pass the function a string. I'm being lazy and not doing my research right now and I apologize for that, but the second console.log isn't necessary.


#7

Ok thank you! :heart:


#8

You are calling the function from inside the function. Try:

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

foodDemand("apples");


#9
var foodDemand = function(food)
{
console.log("I want to eat" + " " + food);
foodDemand(food); // Never call a function inside a function o.O
consol.log("apple"); // Again the same mistake, calling the function inside the function, Also you put "consol.log" which is wrong, Correct the spelling too
}

The final structure should be like this

var functionName= function (parameter) {
    // *Your code goes here*
};

// Run the function here 
functionName(parameter);

Hope that helps :smiley: