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

What is property one? Is that the first line of code that I am missing?

So, I am trying to figure out whether I the error message is on the first line or another line. It's saying can not read property 1 of null? Which code is it?

app.js
let firstName;
let lastName;
let role = 'developer';
let developer += "Patrick + Thomas;

1 Answer

Steven Parker
Steven Parker
231,248 Points

Despite the peculiar error message, the main issue is unbalanced quotes (there's only one) on the last line. But you have a few additional issues:

  • your names should be assigned to the variables as they are created on lines 1 and 2
  • all later references should be made using the variables instead of literal strings
  • the instructions ask for the new variable to be named msg instead of developer
  • the "+=" operator can't be used when first creating a variable (but you won't need it here anyway)

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

Bummer: Make sure you're adding one space (' ') between firstName and lastName.

Now I'm getting this message, I have no idea what to do.

Steven Parker
Steven Parker
231,248 Points

Please show the code with all your recent changes.