Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics Working with Strings Combine and Manipulate Strings

Jeremy Mao
Jeremy Mao
Full Stack JavaScript Techdegree Student 1,889 Points

I'm having trouble solving this.

Not sure what I'm doing wrong.

let firstName = 'Jeremy';
let lastName = 'Mao';
let role = 'developer';
let msg = firstName + ' ' + lastName + ': ' + role + '.';
let msg = role.toUpperCase();

1 Answer

Jason Larson
Jason Larson
7,539 Points

There are 2 issues with your code. First, you are concatenating a period on to the end of role. You don't want to do that. Then, you are changing the entire msg by setting it equal to role.toUpperCase(); in your last line. Get rid of that line, and only apply the .toUpperCase() method to the role variable that is already part of your msg string. The value in the role variable will be capitalized and concatenated without you needing to add an additional assignment.

If you still need help, reply to this message and I'll clarify, but I think you can get it from here.

Andrew Hickman
.a{fill-rule:evenodd;}techdegree seal-36
Andrew Hickman
Full Stack JavaScript Techdegree Graduate 22,580 Points

Yes, Jason is correct. You are reassigning the variable msg every time you use the keyword let. If you want to concatenate to the variable, just use the name and don't reassign it. Here's a hint. The value of msg when this program runs is just "DEVELOPER".