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

Nate Dolber
Nate Dolber
267 Points

I don't really get how to do this, could someone help me out and explain how to?

Could someone tell me what I did wrong?

app.js
let firstName;
let lastName;
let role = 'developer';
role =+ 'Hi' firstName + lastName;

1 Answer

Steven Parker
Steven Parker
231,264 Points

The very first task was "Assign your first name to the variable firstName and your last name to lastName". You need to make those assignments before moving on to the string-building task. The work done in each task of a challenge will always remain for the next tasks(s) unless the instructions say otherwise.

Then, when you get to the step check the instructions carefully and be sure to add only what they ask for (hint: they don't ask for "Hi"). A few more hints:

  • the variable to be created is named msg (not role, that one is pre-defined for you)
  • be sure to use the correct operators between all the parts
  • the correct assignment operator is = (not =+)
  • add literal strings as necessary to create spacing and punctuation to match the instructions
Nate Dolber
Nate Dolber
267 Points

Thanks, I changed the answer to let firstName = 'jon'; let lastName = 'doe'; let role = 'developer'; message = firstName + lastName; and it worked