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

How to convert only Developer to uppercase

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

app.js
let firstName = "Anthony";
let lastName = "Gunsch";
let role = 'developer';
let msg = firstName + ' ' + lastName + " : " + role;

3 Answers

Hi!

You're so close!

Lose the space before the :

And then just add .toUpperCase() to role (to pass task #3).

This passes all three tasks:

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

// Alt Solution (which will also pass) using template literal syntax
// let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`;
// Don't forget the surrounding backticks!

More info:

https://www.w3schools.com/jsref/jsref_touppercase.asp

I hope that helps.

Stay safe and happy coding!

When I follow what you say it tells me to make sure I'm concatenating ':' to lastName and role. What am I doing wrong? Please help.

Thank you and I feel like I need to go through this whole variable upperCase session again!

Can you send me your exact code?

let firstName = 'Lee'; let lastName = 'Samuels'; let role = 'developer'; let msg = '${Lee} ${Samuels}: ${developer.toUpperCase()};

Hi Lee!

After seeing your code, it's clear what the problems are.

First of all, the challenge is about using variables, so use them in the msg string.

Next, since you are attempting to use template literal syntax, you need to surround your string with backticks, not quotes.

Backticks are the lowercase character above the tab key and to the left of the 1/! key. (The uppercase of the same key is the tilda character: ~

Therefore, your last line should be:

let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`; // Note: ` is neither ' nor "

I hope that helps.

Stay safe and happy coding!

Jesse Gonzalez
Jesse Gonzalez
7,322 Points

this challenge is the first one that gave me so much problems. the 3rd question stumped me.