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

JavaScript JavaScript Basics Working with Strings Combine and Manipulate Strings

Joel Parra
Joel Parra
1,395 Points

I need help, it keeps telling me to add my space after I already did. Please help.

I am doing this as I see in others help questions and I keep getting this error.

app.js
let firstName = 'Joel'; 
let lastName = 'Parra'; 
let role = 'developer';
let msg = 'firstName ' + ' ' + 'lastName' + ':' + ' ' + 'role';

1 Answer

Cameron Childres
Cameron Childres
11,820 Points

Hi Joel,

You're really close. You've done a good job of adding in the spaces and punctuation appropriately. The issue is that your variables are inside quotes when you're trying to call them in msg, which turns them in to strings instead of accessing their values. Remove the quotes only around the variable names and you're good to go.

let firstName = 'Joel'; 
let lastName = 'Parra'; 
let role = 'developer';

let msg = 'firstName ' + ' ' + 'lastName' + ':' + ' ' + 'role';
// msg is "firstName  lastName: role"

let msg = firstName + ' ' + lastName + ':' + ' ' + role;
// msg is "Joel Parra: developer"
Joel Parra
Joel Parra
1,395 Points

Thank you so much!