Upose of the " "


#1

I am wondering what the pupose of the " " in middle of string below:


var greeting = function (name) {
    console.log("Great to see you," + " " + name);
};
greeting("bob");


#2

The " " just gives space to your code. For example without " "

console.log("Great to see you,"+ name);
};
Output: Great to see you,Harold

Now with " ":

console.log("Great to see you," + " " + name);
Output: Great to see you, Harold

AS you can see their is a space now between the comma and Harold so it just makes it look nicer. Technically you could also have done this:

console.log("Great to see you, " + name);
Output: Great to see you, Harold

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.