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

pakarang buacharoen
seal-mask
.a{fill-rule:evenodd;}techdegree
pakarang buacharoen
Full Stack JavaScript Techdegree Student 1,897 Points

i am struggling with getting through task contain .toUpperCase

i dont seem to understand what i have done wrong on this. please help if you have any clue.

thank you so much

app.js
let firstName="Pakarang";
let lastName="Buacharoen";
let role = 'developer';
let mew = role.toUpperCase();
let msg= 'firstName' +' '+ 'lastName+':'+ 'mew' +'.';

2 Answers

Hey! So, the problem is how you formulated you string concatenations. There is nothing wrong with the toUpperCase method. If you want to display the value of a variable, you need to leave it outside quotation marks. For example:

let firstName="Pakarang";
let lastName="Buacharoen";
let msg = firstName + " " + lastName;     //value of msg is "Pakarang Buacharoen"

Do you think you can rewrite the assignment to msg that will produce the right string value?

pakarang buacharoen
seal-mask
.a{fill-rule:evenodd;}techdegree
pakarang buacharoen
Full Stack JavaScript Techdegree Student 1,897 Points
let firstName='Pakarang';
let lastName='Buacharoen';

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

The challenge question is

Challenge Task 3 of 3 Finally, convert the string stored in role to uppercase letters. The final msg string should look similar to this: "Carlos Salgado: DEVELOPER".

and once i clicked submit, it shows Bummer: Make sure you're concatenating : to lastName and role.

Great job! You're getting the hang of it. Now, the interpreter is looking at the variable msg for your answer, but you have it stored in a new variable called mew2. Instead of assigning the answer to a new variable, can you figure out how to store it in the msg variable that you've already created? Also, don't forget the space after the colon. ": "

Awesome, way to go!!!