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 trialKimberly DiPasqua
1,934 PointsWorks on Chrome console but not here?
Is there something wrong here? I tried this in Chrome dev tools and got the desired result, but not here.
let firstName = 'Kim';
let lastName = 'DiPasqua';
let role = 'developer';
let msg = `${firstName} ${lastName}: ${role}`;
let roleUpper = role.toUpperCase();
let msg = `${firstName} ${lastName}: ${roleUpper}`;
2 Answers
Rabin Gharti Magar
Front End Web Development Techdegree Graduate 20,928 PointsHey Kimberly DiPasqua,
You have declared msg
variable twice. let
variable can be updated
but cannot be re-declared
.
There are two ways you can pass this challenge by using string concatenation
or template literals
. I will present you with both:
String Concatenation
let firstName = 'Kim';
let lastName = 'DiPasqua';
let role = 'developer';
let roleUpper = role.toUpperCase();
let msg = firstName + ' ' + lastName + ': ' + roleUpper;
Template literals
let firstName = 'Kim';
let lastName = 'DiPasqua';
let role = 'developer';
let roleUpper = role.toUpperCase();
let msg = `${firstName} ${lastName}: ${roleUpper}`;
To learn more about let
variables, check out this website: https://www.w3schools.com/js/js_let.asp
Hope this helps!
Martin Sole
82,199 PointsHi
I think what the challenge is asking for is that toUpperCase is used on the role variable within the msg template literal.
Kimberly DiPasqua
1,934 PointsKimberly DiPasqua
1,934 PointsOhhhhhh d’oh! That makes a lot of sense now. Thank you very much! 🙂