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

Youjin Ok
seal-mask
.a{fill-rule:evenodd;}techdegree
Youjin Ok
Front End Web Development Techdegree Student 1,772 Points

Could please anyone let me know what I have done wrong here? I have been stuck here for so long. Please help!!!

app.js
let firstName= 'Youjin';
let lastName= 'Ok';
let role = 'developer';
const msg= "first name +''+ last name+':'+ role";
Meghan Tucker
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Meghan Tucker
Front End Web Development Techdegree Graduate 33,189 Points

You'll want to make sure you are doing 2 things a little differently in your last line: 1) firstName and lastName are variables that you declared on the first 2 lines: reference them by writing them as the variable name rather than "first name" and "last name" with the spaces. 2) Check to make sure that you are combining the strings correctly with your quotes and spaces. firstName, lastName, and role are all variables that you are calling, rather than strings, so they don't need quotes. You're using the + sign operator to combine your variables with spaces and the colon, which are both strings. Try having the last line look something like this instead:

const msg = firstName + " " +  lastName + ": " + role; 

I hope this helps/ was what you were trying to achieve! Happy coding :)

1 Answer

Youjin Ok
seal-mask
.a{fill-rule:evenodd;}techdegree
Youjin Ok
Front End Web Development Techdegree Student 1,772 Points

Thanks so much Megan! Finally solved! I have been really struggling to get through JS. It seems like a big step from HTML and CSS...; Anyway thanks so much for your help!