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
Marguerite Holden
6,075 PointsCan't figure this out. Can someone help me here? Much appreciated.
var id = "23188xtr"; var lastName = "Smith";
var userName = id + "#" + lastName; userName.toUpperCase();
How to complete the assigment to the userName variable by adding a # symbol followed by an all uppercase version of the lastName variable. Using string concatenation so the final value is "23188XTR#SMITH."
2 Answers
Tim Renner
11,163 PointsYou are so close! you declared userName (var userName=) and set it to be the concatenation of the var id and a hash and the var lastName. The next line calls the method toUpperCase on the previous value but doesn't assign it to anything. You can set a variable equal to the result of altering itself, for example var counter = 1; //do stuff; counter = counter + 1;.
Jason Anders
Treehouse Moderator 145,863 PointsYep, you've pretty much got it.
You just need to have the lastName.toUpperCase() as part of the concatenation. Right now you have two separate variables, and lastName is not uppercased.
var userName = id + "#" + lastName.toUpperCase();
Remember, the lastName variable is what the challenge asked for in uppercase... not userName.
Keep Coding! :)
Sam Nicholson
11,912 PointsJust for clarity, the above answer will give you 23188xtr#SMITH, which I believe is what the challenge asks for.
However, to get the result in quote marks from the question, 23188XTR#SMITH, you would need to call the toUpperCase method on both of your string variables, like this:
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();