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

Carlos Jimenez
PLUS
Carlos Jimenez
Courses Plus Student 4,242 Points

JavaScript Challenge

let msg = 'firstName + ' 'lastName + ' 'role.; Using variables to concatenate strings has error messages with "Cannot read property '1' null, and "Make sure you're adding one space ('') between 'firstName' and 'lastName'. use of the variables methods is what I'm trying to accomplish

app.js
let firstName = 'Carlos';
let lastName = 'Jimenez';
let role = 'developer';

let msg = 'firstName +' 'lastName: +' 'role.';

Hello I continue to receive an error about leaving a space in between the first and last name. Please review strings. I keep pressing the space bar in between single quotes but still receive error. let firstName= "Jeanna"; let lastName='Works'; let role = 'developer'; let msg = "firstName+' '+lastName"+"role"; Thank you for any help!

1 Answer

Hi if you are trying to concatenate the variables, put the plus sign out of the single quotation marks because its just being read as a string.

Hope it works.