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

What is wrong with this code?

Hello. I am on step two of the task "Using String Methods" of "Javascript Basics".

I have done the task two ways, and get an error in both cases.

The first one gives the error 'Oops! It looks like Task 1 is no longer passing.' even though I've done nothing to change the lines that implement Task 1.

The second one gives the error 'Bummer! The userName variable is "23188XTR#SMITH" not "23188XTR#SMITH".' even though the two strings sure do look identical to me.

I have commented out both approaches, but they are both shown.

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

var userName = id.toUpperCase();

// Method 1 (below) produces error "Bummer! The `userName` variable is
// "23188XTR#SMITH" not "23188XTR#SMITH".
// These strings appear identical.
// var userName = id.toUpperCase() + "#" + lastName.toUpperCase();

// Method 2(below) prodcues error "Oops! It looks like Task 1 is no longer passing."
// There does not appear to be anything on the below two lines which should impact
// Task 1.

// var userName += "#";
// var userName += 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>

1 Answer

Steven Parker
Steven Parker
231,007 Points

You first example looks good, but did you modify the task 1 line to make it, or did you add it as an additional line?

(The challenge asks you to modify the task 1 line for task 2).

Thanks for replying! I tried it again and it worked with I think the exact same language, so maybe I made a typo or maybe there is some crazy bug. Anyway, thanks.