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

Paul Barrett
Paul Barrett
3,658 Points

Task 1 no longer processing?????

I've tried every single way of writing this based on what I've just been taught but every time it just comes back with "Task 1 is no longer processing"

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

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

3 Answers

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

Hi there! The answer submitted by Tsenko Aleksiev will work just fine. But it is doable on one line of code which makes the whole thing a little more readable (in my opinion).

On a side note, when you get a "Task 1 is no longer passing" message, it's most often because you've introduced a syntax error and the code can no longer be interpreted. Unfortunately, I have no idea what you've tried thus far, so I cannot pinpoint any syntax error you might have had.

As stated, you can achieve the results required for this challenge on one line of code:

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

This line takes the id and converts it to upper case. Then we place a hashtag in the middle using concatenation. And then turn the last name into uppercase also and concatenate it at the end.

Hope this helps! :sparkles:

Tsenko Aleksiev
Tsenko Aleksiev
3,819 Points

Hi Jennifer! Thank's for the assist! I thought that it's better to learn how to do it the hard way first ( on more lines of code ) and to tackle the challenge one step after another because those are the basics, that's why I didn't show him the one liner. But I forgot to mention the most often reason why is "Task one..bla bla" showing, you're great, thank's again! :)

Tsenko Aleksiev
Tsenko Aleksiev
3,819 Points

I think that this is your solution:

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

This is the first that comes on my mind. I don't know what you did on the second step that's not working. I am using string concatenation "+=" and I "stick the "#" symbol to the userName var, after that I stick to it the lastName var but in upper case. That's it :)

Paul Barrett
Paul Barrett
3,658 Points

Thank you, it's good to see both ways. Looking at the 2 answers I really can't see where I was going wrong because I'm pretty sure I used the shorter version at one point, but as you say, I imagine I had a syntax error in there somewhere