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

Max Turner
seal-mask
.a{fill-rule:evenodd;}techdegree
Max Turner
Full Stack JavaScript Techdegree Student 3,904 Points

Not sure where I am going wrong. I've tried approaching this in a few ways.

Not sure where I am going wrong. I've tried approaching this in a few ways and don't know why the <var userName> is appearing as "23188XTR#Smith". The "#" is appearing and I have no idea why.

app.js
var id = "23188xtr";
var lastName = "Smith";
var string = id.toUpperCase()+lastName;
var userName = string;
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>
Max Turner
seal-mask
.a{fill-rule:evenodd;}techdegree
Max Turner
Full Stack JavaScript Techdegree Student 3,904 Points

Thanks so much for responding. There's nothing in the directions wanting me to concatenate with a "#", just to "Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable." But maybe I misunderstood it. I'll give this a try!

3 Answers

You need to concatenate the # yourself as follows:

var id = "23188xtr";
var lastName = "Smith";
var string = id.toUpperCase()+'#'+lastName.toUpperCase();
var userName = string;
Brandon Evanson
Brandon Evanson
9,482 Points

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

// this takes id variable and upper cases it. Then concatenates # sign. Last step is to concatenate the lastName variable // so it is also upper cased var userName = id.toUpperCase() + '#' + lastName.toUpperCase();

Max Turner
seal-mask
.a{fill-rule:evenodd;}techdegree
Max Turner
Full Stack JavaScript Techdegree Student 3,904 Points

Thanks so much for responding. There's nothing in the directions wanting me to concatenate with a "#", just to "Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable." But maybe I misunderstood it. I'll give this a try!

Concatenating # and last name is for task 2 which is what it appeared you were working on. Task 1 is just converting id to upper case and assigning that to userName - so you'd remove +lastName from what you have above. The bummer message you received is misleading.

Max Turner
seal-mask
.a{fill-rule:evenodd;}techdegree
Max Turner
Full Stack JavaScript Techdegree Student 3,904 Points

Ah, that makes much more sense. I misunderstood what it was wanting me to do in step one. I followed your directions and was able to move on to step 2, which was obviously then the same code. All is well! I understood the lesson, just got confused on the wording of the question. Thanks for your help!