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 trialBrian Jacobs
4,117 PointsCombine and Manipulate strings test
My error message keeps popping up with spacing errors. Ive searched outside and on this app and cannot seem to get it right . Please help?!?!
let firstName = 'Brian';
let lastName = 'Jacobs';
let role = 'developer';
let msg = "firstName + ''lastName':'+ role'.' "
1 Answer
Ignacio Rocha
7,462 Pointsif you want to call another variable inside a new variable you need to take off the quote marks for every variable, and look closely that the second task ask for specific values for firstName and lastName.
let firstName = 'Brian';
let lastName = 'Jacobs';
let role = 'developer';
let msg = firstName + ' ' + lastName + ': ' + role
Austin Whipple
29,725 PointsAustin Whipple
29,725 PointsAnd to expand on Ignacio's answer, the reason this fails with single quotes is because wrapping text in single or double quotes is a way of indicating a string. This challenge is suggesting you pass in the value of a variable. So, for instance,
firstName
without the quotes will pass through "Brian". However, if you wrapfirstName
in the quotes, it will output, literally "firstName" as a string.