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 trialRicky Redman
7,520 Pointscreating a new string combining variables firstName lastName and role
not sure what I'm missing from this code to complete the challenge
const firstName= 'Ricky';
const lastName= 'Redman';
const role = 'developer';
let msg= `firstName '+'lastName:'+'role.`;
2 Answers
Anna Pichugina
25,364 PointsHi Ricky!
In your answer JavaScript is reading everything inside the backticks (`) as a string, including your variable names. Like Mark said, you can use template literals to interpolate your values into the string enclosed by backticks. Another solution that's a little simpler is simply to add strings (and your variables that contain string values) together like this:
let msg= firstName + ' ' + lastName + ': ' + role;
Ricky Redman
7,520 PointsThanks Mark and Ana these were helpful explainations
Mark Casavantes
2,880 PointsMark Casavantes
2,880 PointsHello Ricky,
I think you were confusing regular concatination with template literals.