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

Why is the error task 1 is no longer passing?

i am not sure what i did wrong I tried using the += javascript code for this challenge...

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

var userName = id.toUpperCase() 
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>

4 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Gena! The reason it's saying that task 1 is no longer passing is because you've introduced a syntax error in your code. It doesn't understand what the hashtag is because you haven't enclosed it in quotation marks. There are a couple of ways to fix this. Using your code it could look like this:

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

Or another, possibly more elegant way to do it would be to do this:

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

:bulb: As a side note, JavaScript doesn't require you to end your statements in a semicolon as it has functions that can help do that for you. However, this can lead to ambiguous statements in the long run. It's considered best practice to end all statements in a semicolon.

Hope this helps! :sparkles:

Nando Delgado
Nando Delgado
7,157 Points

Are you just trying to concatenate both strings into upper case first and last name? It's your number sign that was giving you an error.

var id = "23188xtr";
var lastName = "Smith";

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

no, the challenge is Finally, add a # symbol and lastName in uppercase to the end of the userName string. The final value of userName is "23188XTR#SMITH".

so i thought i needed # sign

You forgot to put a semicolon on the end of each line.

Plus, you're missing the quote marks around your #:

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

still not passing