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

Hi. Been trying to convert the string stored in role to uppercase letters.. Please advise.

Hello. Been trying to convert the string stored in role to uppercase letters. Please advise.

app.js
let firstName = "Ceb";
let lastName = "Israel";
let role = 'developer';
let msg = firstName + ' ' + lastName + ':' + role + '.';
let msg = firstName + ' ' + lastName + ':' + role.toUpperCase() '.';

Try removing the period after role.toUpperCase();

The following worked for me...

let firstName = `James`;
let lastName = `Ackerman`;
let role = 'developer';

let msg = firstName + " " + lastName + ": " + role.toUpperCase();

If you look closely at the wording in the code challenge, the period is after the quotations, so they're looking for... Ceb Israel: DEVELOPER

3 Answers

seth aruby
seth aruby
9,354 Points

Ceb, I just completed this challenge using the code suggested in my previous response, minus the concatenation of the period. If your code looks like this then you will be able to complete it as well since the challenge expects the format of the msg string to be "Carlos Salgado: developer". Also, you can't assign the msg variable two different values using 'let' so you must also take out your first 'let msg' declaration, like the following:

let firstName = "Ceb";
let lastName = "Israel";
let role = "developer";
let msg = firstName + ' ' + lastName + ': ' + role.toUpperCase();

finally went through. Thank you so much.

quick question- why did we have to include the period before, but after adding the method to role, we no longer needed it at the end?

seth aruby
seth aruby
9,354 Points

Ceb, Your code to convert role to uppercase looks good. I'm not sure what error you're getting but i suspect it is related to a concatenation error in your last line of code:

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

should be

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

Thank you for the response Seth. I tried yours but didn't work.

The answer to your problem is

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

You're just missing a empty space after colon (:) and you don't need to include the period (.)

Thank you for the response Richard. I tried yours but didn't work.