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 trialChristian Lukacin
2,713 PointsChallenge Task 2 of 3 Below role, create a new variable named msg that combines the firstName, lastName and role variab
Challenge Task 2 of 3
Below role, create a new variable named msg that combines the firstName, lastName and role variab
1 Answer
Peter Vann
36,427 PointsHi Christian!
For some reason, this challenge trips up a lot of people.
They (the teachers/instructions) are correct when they point out to be very careful about having your spacing exact!
This passes task 1:
let firstName = ' Christian';
let lastName = 'Lukacin';
This passes task 2:
let firstName = ' Christian';
let lastName = 'Lukacin';
let role = 'developer';
let msg = firstName + ' ' + lastName + ': ' + role; // declare msg with let
// (and make sure to use use colon + space between lastName and role)
This passes task 3:
let firstName = ' Christian';
let lastName = 'Lukacin';
let role = 'developer';
let msg = firstName + ' ' + lastName + ': ' + role.toUpperCase();
Note: the last line could also be constructed like this (using template literal syntax):
let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`; // also passes
Note: template literals must be surrounded by backticks (that's this: ` not ' nor " )
(The backtick is the key above the tab key and to the left of the 1/! key and its uppercase character is the Tilda: ~ )
I hope that helps.
Stay safe and happy coding!