Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Using String Methods

Not Correct?

I am on the last part on challenging. Even words are displayed in UpperCase all of them and adding '#' between them, it's not working. Does anyone know how to solve this part? Help me

var id = "23188xtr"; var lastName = "Smith"; var userName = id + '#' + lastName; console.log(userName.toUpperCase());

var id = "23188xtr";
var lastName = "Smith";
var userName = id + '#' + lastName;
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="app.js"></script>

3 Answers

Erik McClintock
Erik McClintock
45,783 Points


It isn't worded the best, but unless told otherwise, you need to keep code the same from task to task. Don't delete anything you did previously, and make sure you read the instructions carefully. For this task, you need to keep the call to the ".toUpperCase()" method on both your id and lastName variables.

Your userName variable should look like this...

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

...so that you get their instructed output of "23188XTR#SMITH".


Alternatively you could put .toUpperCase(); in the variable declarations like this:

var id = "23188xtr".toUpperCase();
var lastName = "Smith".toUpperCase();
var userName = id + '#' + lastName;

Thanks for comments guys!! Those are really really helpful resources!! I'll be more careful with writing codes!!