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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsI am stumped! Please help: Below role, create a new variable named msg that combines the firstName, lastName and role va
Below role, create a new variable named msg that combines the firstName, lastName and role variables to create a string
let firstName = "Jeanene";
let lastName = "Cannon";
let role = "developer";
let msg = "firstName + ''lastName: + ''role '.' ";
7 Answers
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsI've also tried the last line as const msg and I've tried different spacing...nothing works
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsI've also tried the += and var - still nothing, so confused.
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsfirstName = "Jeanene"; let lastName = "Cannon"; let role = 'developer'; var msg = 'firstName + ' ' lastName: + ' ' role + '.' ';
I keep getting messages to pay attention to spacing but everything I've tried has been wrong. I can't move forward until I get this right. please advise.
![Rick Gleitz](https://uploads.teamtreehouse.com/production/profile-photos/10566072/micro_highres_446837619.jpg)
Rick Gleitz
47,836 PointsHi Jeanene,
It's all in the formatting of that last line. First, the variables don't have quotes around them. The whole statement doesn't need quotes either. There are a lot of + signs connecting everything together. Also the colon needs to go in a set of quotes along with a space. The previous set of quotes needs a space in it as well. And lastly, don't do anything with the period at the end. It has nothing to do with the challenge, it's just part of the challenge instructions.
It should follow this format: let msg = variable + 'space' + variable + ':space' + variable;
Hope this helps!
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsYes it does help. Thank you so much for taking the time to help me. I just started learning this stuff a few days ago so it's a huge learning curve for me. Thank you again - going to try to implement your suggestions and see how they work out for me.
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsSo this ended up being the answer...that colon with the space really took me a minute to figure out..but thank you to the folks who helped me to figure this out.
let msg = firstName + ' ' + lastName + ': ' + role;
![jb30](https://secure.gravatar.com/avatar/681668d7cc4c5486851384a0feddda37?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
jb30
44,806 Pointslet msg = firstName + ' ' + lastName;
would set msg
to be the value of firstName
followed by a space followed by the value of lastName
. The variables firstName
and lastName
should not be surrounded by quotes, since you want their values and not their names. There should be a +
separating each of the values.
Using string interpolation, this would give the same result as
let msg = `${firstName} ${lastName}`;
![Jeanene Cannon](https://secure.gravatar.com/avatar/41f605d74474964968350f0072639dbe?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jeanene Cannon
Full Stack JavaScript Techdegree Graduate 15,332 PointsThank you so much. This makes total sense...I did actually try it without quotations as well...but I guess I had other errors and nothing worked. This was like my third day doing anything like this so I am still trying to take all this in. Now we were learning about string concatenation - don't think I've learned string interpolation yet with the dollar signs. But thank you because just your explanation helps me to remember how it should be formatted/verbalized/spaced and when/why quotations are appropriate. Thank you for that.