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 trialAmy McKnight
10,124 PointsTrying to make a compound variable. When I add what I thought was the answer. It isn't &/or the 1st task stops working.
I'm having some troubles with this code challenge. Going to rewatch the video 3rd time :-( any help would be apprecated!
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName += id + "#" + username;
<!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>
6 Answers
Amy McKnight
10,124 PointsYes, Thanks again. Love this place!
Amy McKnight
10,124 PointsI found it!
I was inserting a
;
after the first toUpperCase !
Wow. Thanks you all for bearing with me.
All the best
Julian Aramburu
11,368 PointsYay :D! Great you found it yourself! Training the eye for typo/misspell catching would turn your daily coding routine so much easier :D!
Cheers and Keep Coding!
Julian Aramburu
11,368 PointsHi Amy! You got the first task right! Great :D!
In the second one, you are supposed to keep concatenating variables in the same way but you must set the lastName to upper case and add a hashtag before... but you are concatenating "username" I think that's what's causing the error ...also you can concatenate everything in only one sentence like this:
var username = id.toUpperCase() + "#" + lastName.toUpperCase();
Hope you find this answer useful!
Cheers and Keep Coding!
Colin Marshall
32,861 PointsIt wants you to add on to the var username
line in the first task. You are also adding the username value at the end incorrectly. You should be adding an uppercase version of the lastName value at the end. It should look like this:
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Amy McKnight
10,124 PointsWanted to celebrate but it isn't taking it.
I added this code:
var username = id.toUpperCase() + "#" + lastName.toUpperCase();
but I'm still getting this message:
"Bummer! Did you add the '#' character between id
and lastName
?"
YES, I did :-(
is it a bug or me?
Colin Marshall
32,861 PointsThe entire answer to step 2 should look like this:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Julian Aramburu
11,368 PointsDid you write username in your code as well? Because it should be "userName" with uppercase N.
Amy McKnight
10,124 Pointsyes
<code>var userName = id.toUpperCase(); + "#" + userName.toUpperCase();</code>
Julian Aramburu
11,368 Pointsoh i spotted the typo! Delete the semicolon from the first toUpperCase call and it should work properly :)!