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

JS Basics Code Challenge Problems

Can some help me understand what I am doing wrong? I have run out of ideas. 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>

4 Answers

Simon Coates
Simon Coates
28,693 Points

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

Steven Parker
Steven Parker
221,297 Points

The challenge is based on variable assignments. Adding alerts may confuse the checking mechanism.

Simon's solution to task 2 is correct, but it's worth pointing out that each variable is converted separately to upper case, and the final string is created by concatenation (using "+") of the two variables with "#" in between.

I am getting this error code: The userName variable is "23188XTR#SMITH" not "23188XTR#SMITH". Which is confusing because they are the same.

Simon Coates
Simon Coates
28,693 Points

if you're still getting this, suggest posting your code to see if there's anything weird. If there isn't, then you might have stumbled across a bug and you should take a screenshot and send to support.

I got it to work with the help of the forum. :)