Question about lesson 4


#1

I have a question about lesson 4. My code is below. It says it's correct and I'm able to move on, however my code isn't outputting like it's saying it should. When the code runs, all that appears is "I want to eat food" and doesn't include my food when I call on the function.

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

Do I have quote marks in the wrong space or something? Thanks for the help.


#2

Hi you should remove the " " around the food inside the console.log() because they make it a string


#3

I did that and when I called the function, it input "tasty" but the word "food" was nowhere to be found if I remove the quotes around it... That's the only change to the code that I made.


#4

I got stuck on this forever and ended up doing this:

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

Result is : I want to eat cats


#5

Hi does your code look like that ?

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