Trying to create a simple function and not sure where the issue is


This is a very simple function code. When called upon it should print out “I want to eat pizza”, but I think there is something wrong in the console.log line.
I have tried to not add any " after food and written it like

console.log(“I want to eat” + " + food);

that gives the error message that food is not defined. When I added the " at the end (as in the code below) I get an error message saying SyntaxError: missing ) after argument list. Where is there an extra parantheses?

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


HI this part");

remove the "

And you should call the function foodDemand() instead of food()


I did that just now I am getting the same error message. I have attached a picture of it



after eat there are quotation marks ("), this should be one


Thanks now it works.


a little more background information, you can join two strings together by adding a plus sign:

"hello" + "world"

you can also join a string and a variable together:

"hello" + test

if you have a variable, don’t use quotation marks, this is for strings. you can also insert an additional space in the string you are joining:

"hello" + " "+ test

although, i then would prefer this:

"hello " + test

put the space simple after hello


thanks that was very helpful.