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.

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 29,180 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!