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

Carl Odiloff
Carl Odiloff
2,222 Points

how to convert the string to uppercase?

app.js
let firstName = "Carl";
let lastName = "Odiloff";
let role = 'developer';
let msg = firstName + ' ' + lastName + ': ' + role;
let newForm = role.toUpperCase();

4 Answers

Steven Parker
Steven Parker
231,007 Points

You're using the conversion method properly, but it needs to be done as part of the string being assigned to the "msg" variable. And you won't need to create an additional variable.

Steven Parker
Steven Parker
231,007 Points

The second assignment overwrites the first one. The case conversion should be done as part of just one assignment:

 let msg = firstName + ' ' + lastName + ': ' + role.toUpperCase();
Carl Odiloff
Carl Odiloff
2,222 Points

Thanks for your reply Steve, I appreciate it. However, I tried what you advised me but it did not work, I tried everything, but nothing seems to work, I do not know maybe there is a glitch in this system. I will try again later, never give up)

Steven Parker
Steven Parker
231,007 Points

Please show the exact code after your changes, perhaps there's another issue.

Carl Odiloff
Carl Odiloff
2,222 Points

That worked, still wondering how i could not come up with this. Thank you for your help

Carl Odiloff
Carl Odiloff
2,222 Points

Hi Steve,

Here is my code after all changes:

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