Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Foundations Strings Concatenation

I'm not sure there is a correct answer. The following code will report errors with variables "first", "name and "last"

Declared variables are first_name and last_name^ but you invoke console.log with variables "first", "name" + "last" "name". That's a typo, I think :)

3 Answers

I am not certain what you are saying, I did not personally look at the video yet but I would assume that if you had something like concatenating two strings then you would do something like this.

//Just an example
var first_name = "John";
var last_name = "Doe";
console.log(first_name + " " + last_name);

Now I am assuming that is what it is actually asking for, but again I have not looked at the video. I think I looked at it almost two years ago.

Let me know if there is anything else I can help you with, or if you wanna reword your question differently.

This is a very strange thing. When I copy and paste the text of quiz, everything is ok. But when I see it in my browser, underscore characters are not displayed in function call.

Here is the screenshot. link

I am not sure why that shows like that, but the thing is if you are concatenating strings if you do not declare a space on either of the variables values, then there will not be a space between the strings.

var first_name = "John"; var last_name = "Doe";

console.log(first_name + last_name); Output > JohnDoe

console.log(first_name + " " + last_name); Output > John Doe

Not sure if your question is still a question anymore.. or more of pointing out a bug in the system.