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

Adding uppercase to JS

Hi, I am pretty stuck on a question. The question is:

Add a # symbol and lastName in uppercase to the end of the userName string. The final value of userName is "23188XTR#SMITH".

Here is what I have so far. I'm not understanding how to make lastName uppercase as well as if my last line (concatenation) is correct.

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

var userName = idtoUpperCase(); var message = "id" + "#" + "lastName"

app.js
var id = "23188xtr";
var lastName = "Smith";

var userName  = idtoUpperCase();
var message = "id" + "#" + "lastName"
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>

4 Answers

Steven Parker
Steven Parker
229,732 Points

The instructions say to "add a # symbol and lastName in uppercase to the end of the userName string." There's nothing about creating a new variable named "message".

Also, you need a period between a variable name and a method you call on it (such as "toUpperCase()").

And for the final step both the id and the lastName need case conversion.

I was going by an example I had, but I am extremely confused. It's really having us go beyond what we have even learned, without having all of the information.

How do you add case conversion? I have one example, of "var userName = idtoUpperCase();" but I don't understand why I am using the "id" variable. In my head, I only need 2 things to make something uppercase -one variable, and the instruction to add it to uppercase, not a 2nd variable.

I have no idea on this one, I feel like I don't have enough information to complete it. How do I add something to the end of a string?

I thought maybe this would be closer, but its not right.

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

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

Steven Parker
Steven Parker
229,732 Points

That is pretty close, but both the id and the lastName need case conversion. Right now only the id is being converted to upper case.

I just figured it out, thank you for your help and motivation!