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

How Do I do this?

let firstName = 'Mohammed'; let lastName = 'Esak'; let role = 'developer';

let msg = firstName + " " + lastName + ": " + role;

How do make the variable role all upper case so the final msg reads, "Mohammed Esak: DEVELOPER".

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

5 Answers

Rick Gleitz
Rick Gleitz
47,839 Points

Whoops!, sorry. The change to role should be : role.toUpperCase(); Totally my mistake. I should have known better. I just did this myself a few days ago, and as a review no less! That should fix it (in addition to only having one let msg declaration). Again, so sorry!

Ah yes ! That has worked. Thanks I finally understand this now ( :

Rick Gleitz
Rick Gleitz
47,839 Points

Aziz has it right, except he forgot the colon part (but you didn't, Mohammed).

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

Answer: let firstName = 'Mohammed'; let lastName = 'Esak'; let role = 'developer';

let msg = firstName + " " + lastName + ": " + role;

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

When I submit that answer I get the error, "Bummer: Cannot read property '1' of null"

I don't see what I am doing wrong here.

I hope you can help ( :

I guess your not making a space in the "". so it should be " "

There is a space in between the 2 quotation marks but I still get the error. I would like to pass this quiz before moving on ( :

Rick Gleitz
Rick Gleitz
47,839 Points

You are declaring msg twice: delete the first statement and see if that helps.

The first statement was the task 2 of the challenge which I passed. If I remove it I get the same error.

Task 1: Assign your first name to the variable firstName and your last name to lastName.

let firstName; let lastName; let role = 'developer';

Task 2 : Below role, create a new variable named msg that combines the firstName, lastName and role variables to create a string like "Carlos Salgado: developer".

HINT: Pay close attention to the spaces in the string.

let firstName = "Mohammed"; let lastName = "Esak"; let role = 'developer';

let msg = firstName + " " + lastName + ": " + role;

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

Answer:let firstName = "Mohammed"; let lastName = "Esak"; let role = 'developer';

let msg = firstName + " " + lastName + ": " + role;

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

This is where it says it is incorrect and gives me the error: Cannot read property '1' of null