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 trial

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

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?

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.