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!
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
Mark Bernard2,746 Points
.toUpperCase seems to be changing all strings.
Trying to complete this challenge but I keep getting this error message.
userName variable is "23188xtrSmith" not "23188XTR#SMITH".
Not sure what is going wrong.
I have also tried to add the .toUpperCase property in the var id on line 1 and in the final var on line 4, I just get the same message?
var id = "23188xtr"; var lastName = "Smith"; id.toUpperCase(); var userName = id + lastName;
Jennifer NordellTreehouse Teacher
Hi there! I like that you've tried different things and told us what they are! That is always appreciated and ultimately makes a better experience for you. On your 3rd line, you are using the
On your final line you have the id and the last name concatenated together. But again, that upper case version of
id wasn't saved anywhere so it's accessing the original value in
id which is still all lower case. I do not see anywhere that you've turned the last name to uppercase which is also a requirement. Between the uppercase
id and the uppercase
lastName, you will also need to concatenate a '#'. I feel like many people get thrown off this, but there is nothing really special about this character at all. It's just another character like any other.
The first step you obviously figured out. You make a variable named
userName and assign it the uppercase version of
Finally, add a # symbol and lastName in uppercase to the end of the userName string.
So let's break it down.
Add a # symbol.
var userName = id.toUpperCase() + "#"; // the value will now be 23188XTR#
lastName in uppercase:
var userName = id.toUpperCase() + "#" + lastName.toUpperCase(); // the value will now be 23188XTR#SMITH
Hope this helps!
Note: you can safely delete line 3 as it ultimately does nothing.