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

Lost

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!

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

2 Answers

Michael Davis
PLUS
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
seal-mask
.a{fill-rule:evenodd;}techdegree
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".