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 Using String Methods


Not sure how to do what it is asking... I went back but if I could see what the solution is I could reverse engineer how and why it worked. Any help? Thanks!

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

2 Answers

Michael Davis
Michael Davis
Courses Plus Student 12,508 Points

Step 1 is asking us to use the .toUpperCase() method to assign the Upper Case ID into userName.

var userName = id.toUpperCase();

Step 2 is asking us to use concatenation to concat a hash and the lastName to the end of the userName.

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

Hi Jordan,

The first part of the challenge asks you to assign an all uppercase version of the "id" variable to the "userName" variable.

To get that, you declare the "userName" variable to be equal to the "id" variable and call the toUpperCase method on "id"

i.e. Your code should look like this:-

var userName = id.toUpperCase();

Once that has been done, part 2 of the challenge asks you to add a "#" and lastName (again in uppercase), so you would use concatenation.

Your code should look like this:-

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

Hope that helps :-) Don

Moderator edited: Converted to an answer.

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi Don Macarthur! I've converted your comment to an answer so that it will be eligible for up-voting and/or possible selection for "Best Answer". :sparkles:

Thanks Jennifer. For some reason when I was posting there was no "answer" option available, only a "comment".