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 trialJonny Strange
6,412 PointsStuck on the question
I'm a bit stuck on this question because it's adds '#' but I'm not sure how to concat it??
var id = "23188xtr";
var lastName = "Smith";
var userName = id += '#' + lastName.toUpperCase();
<!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
Gavin Ralston
28,770 PointsKeep in mind that the error message you're seeing is just a good guess.
If you're sure the # is added in there, then double-check the other requirements of the challenge and make sure those are being met. Like for instance, if the challenge requires ALL text to be capitalized you'll need to figure out a way to capitalize both of the entries, not just the last one.
The code I posted above definitely passes one of the challenges, so make sure you're not further along and have another requirement. The good news is that you got ride of the error message complaining about assignment and left- or right-handed values, right?
Gavin Ralston
28,770 Pointsvar userName = id += '#' + lastName.toUpperCase();
That second operator, +=, might be thorwing things out of order a bit, since you're telling js to take everything to the right (i.e. '#' + lastName.toUpperCase() ) and assign it to the left (i.e. id ) then.... assign it to the variable ( i.e. userName )
If the format you have is what is expected, try this:
var userName = id + '#' + lastName.toUpperCase();
thomas bethell
7,772 PointsHey Gavin,
I am having the same issue. I tried just waht you said above, and I get the same "Bummer did you add the '#' between the id and lastName variables" error that Johnny was getting.
Any thoughts in to what is causing this?
UPDATE: Nevermind, I found my mistake, it was a syntax error, I had an extra semi colon. After taking it out this worked!
Jonny Strange
6,412 Pointsi tried this but it still doesn't work
Gavin Ralston
28,770 PointsWhen you say it doesn't work, are you saying that there's an error message in the "Bummer!" warning bar in the code challenge, or is it saying that it's just not getting the response it wanted?
Do both words need to be capitalized?
Jonny Strange
6,412 PointsYes, I'm getting an error message saying 'did you put the '#' between id and lastName?'
Alan Gormican
7,792 Pointsid.toUpperCase() + "#" + lastName.toUpperCase();