First question here. I am doing Codecademy's JS basics course and have run into a question concerning concatenation in functions.

I have:

var greeting = function(name){

console.log("Hello, "+"" +name);


Obviously, when I call this function with:


I get, Hello, Chris

What if I wanted to spice that up a bit and have the output say, Hello, Chris. How are you doing today?

I tried several different things that all lead to syntax errors. For example:

var greeting = function(name){

console.log("Hello, "+"" +name "." ""+" How are you doing today?);


So, the question is how do I join the next strings after including the function output following the initial string? I don't know if that sentence makes any sense. So, In plain english, how do I get the period and the subsequent question in there after the output, Hello, Chris?

Thanks for any help!

closed as off-topic by heavyd, Ƭᴇcʜιᴇ007, DavidPostill, CharlieRB, Dave Mar 31 '15 at 7:35

  • This question does not appear to be about computer software or computer hardware within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.


You're missing a + operator.

console.log("Hello, "+"" +name "." + ""+" How are you doing today?);

You also have a couple of empty strings that could be removed:

console.log("Hello, " + name "." + " How are you doing today?);

Although you may know that here is not the place to ask such questions but I have to tell you that, javascript concatenation uses the join() function which uses the comma , for joining if you dont provide it any arguments (as you provided "")
Use " " (quotes with space between) instead of ""

Not the answer you're looking for? Browse other questions tagged or ask your own question.