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 trialCarlos Jimenez
Courses Plus Student 4,242 PointsJavaScript 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
let firstName = 'Carlos';
let lastName = 'Jimenez';
let role = 'developer';
let msg = 'firstName +' 'lastName: +' 'role.';
1 Answer
Elroy Jochoma
4,849 PointsHi 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.
jeannaworks
4,136 Pointsjeannaworks
4,136 PointsHello 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!