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

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Working with Strings and Finding Help

Hello! Can anyone help about question of the using string methods' 2.2? thanks in advance

Using String Methods

Steven Parker
Steven Parker
231,268 Points

I'm sure you can get some help, but first please show the code you submitted for task 2 so we can see what the issue is.

Hi Steven,

Q : Finally, add a # symbol and lastName in uppercase to the end of the userName string. The final value of userName is "23188XTR#SMITH".

I have written this code for task 2;

var id = "23188xtr"; var lastName = "Smith";

var userName = id + "#" + lastName;

alert(userName.toUpperCase());

3 Answers

Steven Parker
Steven Parker
231,268 Points

You're pretty close.

Now that I see your code I can make some suggestions:

  • remember in task 1 you made "an all uppercase version of the id variable"? You still need that part.
  • then when you add the symbol and lastName, the lastName must also be in uppercase.

So really all you are missing is to convert each name to uppercase. And the alert is not needed for the challenge.

Steven, Probably Im missing one thing :(

var userName = id.toUpperCase(); + "#" + lastName.toUpperCase();

Steven Parker
Steven Parker
231,268 Points

Not "missing", but you have something "extra". You have a stray semicolon near the middle of the line right before the first "+" symbol.

hey Steven I want to huge tanks to you You are legend :)