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 trialsierra giffin
739 PointsConverting a string stored in a variable to upper case fails in a variety of methods that should work.
we were able to get a answer 3 different ways within the w3schools console, but team treehouse says its wrong each way
let firstName = "sierra";
let lastName = "giffin";
let role = "developer.toUpperCase()";
msg = firstName + ' ' + lastName + ':' + role + ':';
4 Answers
Tim Oltman
7,730 PointsHi Sierra,
As Mohammad is pointing out, you need to call the method toUpperCase() on a string. In your code it is simply part of the string and the browser won't recognize it as a function that needs to be performed.
Here is another way you might structure your code:
let firstName = "sierra";
let lastName = "giffin";
let role = "developer".toUpperCase();
msg = firstName + ' ' + lastName + ':' + role;
Mohammad Azawi
Courses Plus Student 5,631 Pointslet firstName = "sierra";
let lastName = "giffin";
let role = "developer";
let msg = `${firstName} ${lastName}: ${role.toUpperCase()}`;
ch.ienwie suh
Courses Plus Student 1,143 Pointstried all 3 way you provided and it still dint't work. don't know how to make it work.
Mohammad Azawi
Courses Plus Student 5,631 PointsHow come my code isn't working ? I solved the challenge before posting my solution.
sierra giffin
739 PointsI believe that there is a bug, do you know how to get help from TTH staff?
Tim Oltman
7,730 PointsHi Sierra,
I think I figured out your problem. You need to pay attention to the HINT. The spaces really matter here. There should be a space between the colon and the role.
The following code worked for me.
let firstName = "Tim";
let lastName = "Oltman";
let role = 'developer';
let msg = firstName + " " + lastName + ": " + role.toUpperCase();
Mohammad Azawi
Courses Plus Student 5,631 PointsMohammad Azawi
Courses Plus Student 5,631 PointsYou missed to declare your (msg) variable.
let msg = "the rest..";
Jelena Feliciano
Full Stack JavaScript Techdegree Student 12,729 PointsJelena Feliciano
Full Stack JavaScript Techdegree Student 12,729 PointsVery helpful. Listen to this guy.
Mohammad Azawi
Courses Plus Student 5,631 PointsMohammad Azawi
Courses Plus Student 5,631 Points@ Jelena Feliciano, I don't know if you mean me or not , but thanks any way.