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

John Fulstone
PLUS
John Fulstone
Courses Plus Student 762 Points

How do I create a space between in a string.

let firstName = "John"; 

let lastName = "Fulstone";

let role = 'developer';

let msg = firstName + lastName + role;

I keep getting the message to remember a space between firstName and lastName. I've worked on this objective for four hours and am still drawing a blank!

4 Answers

You can also do this

let msg = `${firstName}  ${lastName} ${role}`;

The above you use backticks like these `` which are found on the key next to the 1 key on your keyboard. This is known as string interpolation :)

hey John Fulstone you can do it like so:

let firstName = "John";
let lastName = "Fulstone";
let role = "developer";
let msg = firstName + " " + lastName + ": " + role;

let me know if you have any questions!

John Fulstone
PLUS
John Fulstone
Courses Plus Student 762 Points

That did it!!! I just learned something. This was definitely not covered in the training video up to this point. However, it was in the hints but I misinterpreted them. Thank You Very Much!!

No problem. Keep at it!

John Fulstone
PLUS
John Fulstone
Courses Plus Student 762 Points

Wow! I that's good to know. I'm older than and new to all this. I appreciate the help!