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 trialMohammed Esak
3,574 PointsHow 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".
5 Answers
Rick Gleitz
47,839 PointsWhoops!, 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!
Mohammed Esak
3,574 PointsAh yes ! That has worked. Thanks I finally understand this now ( :
Rick Gleitz
47,839 PointsAziz has it right, except he forgot the colon part (but you didn't, Mohammed).
Mohammed Esak
3,574 PointsQuestion : 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 ( :
Aziz Deghais
4,553 PointsI guess your not making a space in the "". so it should be " "
Mohammed Esak
3,574 PointsThere 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
47,839 PointsYou are declaring msg twice: delete the first statement and see if that helps.
Mohammed Esak
3,574 PointsThe 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
Aziz Deghais
4,553 PointsAziz Deghais
4,553 Pointslet msg = firstName+ " " + lastName + toUpperCase(role);