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

JS Basics Code Challenge Problems

Can some help me understand what I am doing wrong? I have run out of ideas. Thanks!

app.js
var id = "23188xtr";
var lastName = "Smith";
alert(id.toUpperCase());
var userName = "23188xtr#" + "Smith";
alert(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>

4 Answers

Simon Coates
Simon Coates
28,694 Points

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

Steven Parker
Steven Parker
231,248 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,694 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. :)