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 trialbevinwg
5,196 Pointssecond portion of this code challenge. My error message says I've gotten the correct answer but it is counted as wrong.
I realize I am not writing this correctly, but am stuck. Even though I am getting the code to do what the question is asking, I keep getting an "incorrect Bummer message" even though the answer is coming back the way they want it to show. I am not sure why I can't seem to wrap my head around this.
var id = "23188xtr";
var lastName = "Smith";
var userName
id.toUpperCase();
var userName= (id.toUpperCase() + '#'+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>
2 Answers
Carlos Federico Puebla Larregle
21,074 PointsDon't forget to use the "=" operator on your first declaration of your "userName" variable. If you assign the upper case version of the id to the "userName" variable you can "re-use" it in the concatenation part like this:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName = userName + '#' + lastName.toUpperCase();
So you don't need to assign the "id.toUpperCase()" to the userName variable again, it's already in there, and be careful not putting the "var" keyword twice. It means that you're stating the variable again.
I hope that helps you a little bit.
John Halbert
12,922 PointsYou are on the right track. You added some unnecessary parenthesis, but those weren't exactly hurting anything. I think the issue is located on your fourth and fifth lines. I'm not sure what you're doing there.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
bevinwg
5,196 PointsThank you. I think I am overcomplicating it and have been staring at it too long! Lol!
bevinwg
5,196 Pointsbevinwg
5,196 PointsThank you. I've tried it several ways and think I am overcomplicating it and have been staring at it too long... When I tried it again like your example I got a green return message from Treehouse saying something like "Ooops, communication error, try your problem again."
Thank you for clarifying the translation!