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

Ben Holmes
Ben Holmes
4,645 Points

When I add "#" + lastName it says that Task 1 is no longer complete

Didn't change any code from task 1 but it suddenly says that it doesn't work

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

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

2 Answers

Maxime Duhamel
Maxime Duhamel
7,169 Points

Hi,

You seems to have forgotten to put a semi-column at the end of the statement which declare the variable userName. It worked before because it was your last line of code but know the program will read your 2 last lines as a single statement without the semi-column.

Max

nico dev
nico dev
20,364 Points

Hi Ben Holmes,

What Maxime said is true. Plus: you're required to add toUpperCase() to lastName (just as you've already done for id).

Here's what the output should be like:

The final value of userName is "23188XTR#SMITH".

Ben Holmes
Ben Holmes
4,645 Points

Oh OK, thanks. I still don't get why it said that Task 1 no longer passed, but it worked when I fixed all of that.