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 trialJohn Fulstone
Courses Plus Student 762 PointsHow 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
Mark Branscum
Front End Web Development Techdegree Graduate 13,950 PointsYou 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 :)
Ryan Groom
18,674 Pointshey 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
Courses Plus Student 762 PointsThat 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!!
Ryan Groom
18,674 PointsNo problem. Keep at it!
John Fulstone
Courses Plus Student 762 PointsWow! I that's good to know. I'm older than and new to all this. I appreciate the help!