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

How Do I Return the Value Requested?

For this challenge question I was commanded to do the following:

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

This is what I came up with as I was not sure how to write what was asked in the form that was required.

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

var userName = id + lastName.toUpperCase();

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

My answer was incorrect. This is the message that I received;

Bummer: The `userName` variable is "#23188xtrSMITH" not "23188XTR#SMITH".   

How do I return the correct variable? I am lost.

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

var userName = id + lastName.toUpperCase();
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>

3 Answers

I too, am having the same problem. The issue is, the question is worded that the solution will be "23188XTR#SMITH." Everything is uppercase. However, after inserting the code, the error message comes up saying that it's supposed to be "23188xtr#SMITH." So now, "xtr" isn't supposed to be uppercase. There isn't consistency here with the question.

You are missing parentheses after id.toUpperCase.

The question above did not post correctly. Please bare with me as I am new and this is my first time posting a question.

Using String Methods Challenge Task #2

What I have entered in:

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

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

Bummer:Β The `userName` variable is "function () { spyList.push(method); object[method]._isCalled = object[method]._isCalled + 1 || 1; object[method]._args = object[method]._args || []; object[method]._args.push(Array.prototype.slice.call(arguments)); if(typeof proxy === 'function') { return proxy.apply(this, arguments); } else { throw "`" + method + "` is not a method. Did you mean `" + correctMethod + "`?"; } }#SMITH" not "23188XTR#SMITH".



Thanks for any assistance in advance.