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

I can't get past this task, even though I get the exact same value that it asks for. it looks like Task1 is no longerpas

I can't get past this task, even though I get the exact same value that it asks for. it looks like Task1 is no longerpassing

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

var userName = id.toUpperCase();



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

alert(userName);
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>

1 Answer

You have modified the original value of the variable lastName.

Where you are doing:

lastName = "#" + lastName.toUpperCase();

You are changing what lastName actually is.

Also when you do

userName = id + lastName;

The result isn't the exact same thing as the id portion is no longer upper cased.

What you are going to want to do is concat by saying userName = userName + or say userName += then the exact same thing you are doing here:

"#" + lastName.toUpperCase();