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 trialJorge Saucedo
19,607 Pointsthe problem is that the task is asking me to use toUpperCase on "lastName", but the solution tips tells me that is wrong
the problem is that the task is asking me to use toUpperCase on "lastName", but the solution tips tells me that is wrong. I'm having a hard time figuring this out.
TASK: Complete the assignment to the userName variable by adding a # symbol followed by an all uppercase version of the lastName variable. In other words, using string concatenation so that the final value of userName is "23188XTR#SMITH".
var id = "23188xtr";
var lastName = "Smith";
id.toUpperCase();
var userName = id + "#" + lastName.toUpperCase();
It tells me that it is wrong! -.-!
3 Answers
Chyno Deluxe
16,936 PointsDavid is correct. It is only making a seperate instance of id rather then setting it as the variables value. there are a few ways to answer this challenge. if you were to follow your current code. then I would try this.
var id = "23188xtr";
var lastName = "Smith";
id = id.toUpperCase();
var userName = id + "#" + lastName.toUpperCase();
I hope this helps.
David Garner
4,181 PointsIt first asks you to assign the an Upper case value of id to username.
This line
id.toUpperCase();
does not set the an Uppercase version of id to username.
The .toUpperCase(); method returns a string back IT DOES NOT SET id to an upper case string;
You need to set username to an uppercase version of id then set username to it's current value + the "#" + uppercase version of lastName.
Jorge Saucedo
19,607 PointsThanks Guys!
Chyno Deluxe
16,936 PointsChyno Deluxe
16,936 Points//Fixed Code Presentation