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

I keep getting the error: Did you add the '#' character between `id` and `lastName`?, no matter where I've tried adding.

The question is: 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". I have tried doing a = '+'; behind the id and also a new line and get the same error.

Can you post your code?

3 Answers

The challenge wants you to add to your existing userName variable. At this stage it should already be set to id.toUpperCase(). So you need to add the # to it, then follow that with lastName.toUpperCase(). In JavaScript you use the + to concatenate strings. Like this:

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

Showing the a bit of the code you are working on helps but in general practice you do this.

str1 = "foo";
str2 = "fun";
str3 = str1 + " " + str2;

You might have to use a unicode for the # symbol, I can't remember if it is a special character in JS.

Sorry that my code it make it. I never saw where I could add it today. Here is one of the ways I tried: var id = "23188xtr"; var lastName = "Smith"; var str = 'lastName'; alert( str.toUpperCase + '+'() ); var userName

Right below where you make a post the is a link "Markdown CHeatsheet" that will teach you how to post code.