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

Tadjiev Codes
Tadjiev Codes
9,626 Points

Finally, convert the string stored in role to uppercase letters. The final msg string should look similar to this: "Carl

Finally, convert the string stored in role to uppercase letters. The final msg string should look similar to this: "Carl

app.js
let firstName = "Muhammed";
let lastName = "Tadjiev";
let role = 'developer';
const msg = firstName + " " + lastName + ":" +  role + "."; 
let bigLetters = role.toUpperCase();
Volodymyr Rusnyk
Volodymyr Rusnyk
9,657 Points

Is anybody know how to add UpperCase to role? I have tried all those methods and it doesn’t work I don't know why?

17 Answers

Tadjiev Codes
Tadjiev Codes
9,626 Points

You're welcome) Don't forget to click it as the Best answer and +1 LOL)

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

Tadjiev Codes
Tadjiev Codes
9,626 Points

Just by clicking the button Best Answer Lol. Thanks

Tadjiev Codes
Tadjiev Codes
9,626 Points

String interpolation I meant*

Volodymyr Rusnyk
Volodymyr Rusnyk
9,657 Points

Mukhammadkhon Tadjiev, you so helpful. The code is working, thank you so much!

benoit koch
benoit koch
3,875 Points

yes! this worked lol . I have been racking my brain over this.

Gavin Eyquem
seal-mask
.a{fill-rule:evenodd;}techdegree
Gavin Eyquem
Front End Web Development Techdegree Student 20,732 Points

I've been trying different ways to get this right and your answer worked for me. This tells me that the JavaScript Basics course need updating.

Dimitar Dimitrov
Dimitar Dimitrov
11,800 Points

You can use the method .toUpperCase() in the string concatenation

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

or you can use the new ES syntax and type it like that which is far more readable

let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`;

so I typed this
let letters = role.toUpperCase(); and its giving me the error "Bummer: Use the .toUpperCase() method to convert the role string to all upper-case."

what am I doing wrong?

Volodymyr Rusnyk
Volodymyr Rusnyk
9,657 Points

No, how to add upper case to role string

Dimitar Dimitrov
Dimitar Dimitrov
11,800 Points
const msg = firstName + " " + lastName + ":" +  role.toUpperCase() + "."; 

this is the answer and it has been aswered in the same thread you add .toUpperCase() to the role variable.

Volodymyr Rusnyk
Volodymyr Rusnyk
9,657 Points

Is anybody know how to add UpperCase to role? I have tried all those methods and it doesn’t work I don't know why?

Tadjiev Codes
Tadjiev Codes
9,626 Points
let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`;

Try to use the ES syntax with the string interiorlation. Well at least it worked for me) The challenge probably wants to use the new Syntax

Kate C
Kate C
13,589 Points

It is so weird instead of typing the answer like : const msg = firstName + " " + lastName + ":" + role.toUpperCase() + "."; the system only accept : const msg = ${firstName} ${lastName}: ${role.toUpperCase()};

But at this point, we don't know the answer the system accept.

so as was going over this again ,.. this is what I thought the answer would be, as it made sense with what we had learnt so far .. .. let msg = firstName + " " + lastName + ":" + role.toUpperCase() + "."; but alas this is the correct answer, let msg = ${firstName} ${lastName}: ${role.toUpperCase()}; and I am feeling abit lost now .. .

Tadjiev Codes
Tadjiev Codes
9,626 Points

Hey, this is just a new way of string concatenation or string interpolation in other words. The handy part of the new method you don't need bunch of + pluses as it'll contact anyways and even create space when you leave some blank space. But you need also backticks to begin and to close

Tadjiev Codes
Tadjiev Codes
9,626 Points

let firstName = "Tadjiev"; let lastName = "Ruslan"; let role = 'developer';

This is the answer to what you're asking?

Volodymyr Rusnyk
Volodymyr Rusnyk
9,657 Points

I don't know why but it didn't work.

Volodymyr Rusnyk
Volodymyr Rusnyk
9,657 Points

Dimitar Dimitrov, you so helpful, The code is working, thank you so much!

pfff posted this:

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

still a "Bummer" feedback. what am i doing wrong here?

Hello, This is what worked for me, hope it helps. Blessings. https://imgur.com/a/NCotEG4

Tadjiev is correct. The course doesn’t tell you but, you need to use the new syntax using the ` , $ and {} instead of single quotes. View his answer. Worked for me as well. Thanks Tadjiev!

Nicholas Prober
Nicholas Prober
4,925 Points

This is a huge reason why I think people quit this program. It seems like the quizzes don't align with what we just learned in the other videos which leads into a crapload of time wasted and major frustration. The hint is absolutely crap and confusing, Why would you name something "Shout" then not show the code which it refers to so that we can make sense of it and use the code in a similar fashion to answer this question directly. Instead here I am, confused as heck joining what looks like a lot of people frustrated over the exact same thing.