Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Combining strings via Concatenation

Below role, create a new variable named msg that combines the firstName, lastName and role variables to create a string like "Carlos Salgado: developer".

  1. let firstName = 'Carlos';
  2. let lastName = 'Salgado';
  3. let role = 'developer';

My answer

  1. let firstName = "Carlos";
  2. let lastName = "Salgado”;
  3. let role = 'developer';
  4. let msg = 'firstName' + 'lastName’ + 'role’;

I am getting a Bummer. Please help.

1 Answer

Guillermo Gallo
Guillermo Gallo
Full Stack JavaScript Techdegree Student 8,490 Points

Hi Chinonso Umeanoikwa

You are close, but you need to make some adjustments. Right now you are just saving the string firstNamelastNamerole to the msg variable.

You need to remove the quotes around the variable names in order to get the variable’s value. Or you can use template literals with backticks to create the correct string with the variable names. If using backticks, remember to use interpolation to add the variable values into the string.

Finally you need to make sure you have the format required for the challenge, in this case you are missing some white spaces between first and last name and you are also missing an : and a white space after the last name.

Something like this:

let msg = firstName +   + lastName + :  + role;

Or with backticks

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