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 trialXolani Mdluli
2,099 PointsI have tried everything to have spacing between the firstName and lastName but still no luck
let firstName = "Xolani";
let lastName = "Mdluli";
let role = "developer";
let msg = "firstName " + " " + " lastName" + "." + "role";
4 Answers
Steven Parker
231,275 PointsHeidi's right about the colon character, but there should also be a space after it.
However, the main issue here is that variable names should not be enclosed in quotes!
let msg = firstName + " " + lastName + ": " + role;
Samy TALBI
2,617 PointsFirst, your code works on my Chrome console (with spaces).
You can also use template literals (``) :
let msg = ${firstName } ${lastName}.${role}
;
Jason Larson
8,361 PointsI don't think this came out the way you intended because of the markdown. It's a good idea to preview your answers before posting to ensure they look like what you intended. I think you meant to write:
let msg = `${firstName} ${lastName}.${role}`;
You can also put text in code boxes, which makes it even easier to read:
let msg = `${firstName} ${lastName}.${role}`;
Note that the proper solution should actually be one of these 2 options:
let msg = `${firstName} ${lastName}: ${role}`;
let msg = firstName + " " + lastName + ": " + role;
Heidi Fryzell
Front End Web Development Treehouse Moderator 25,178 PointsHi Xolani,
I also think you might be running into trouble because you put a "." before "developer".
The instructions say that they want a ":".
"Carlos Salgado: developer"
Hope this helps and happy coding!
Xolani Mdluli
2,099 PointsThank you all for the assistance. I made it past the challenge.