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 trialDavid Dehghani
6,992 PointsAdding variables..
I don't think I have this down quite right. Is there something I'm missing? Or am I doing this wrong?
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName = id + '#' + lastName;
<!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>
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! You're doing great, and you're really close here. But they don't just want the id to be uppercase, they also want the lastName
to be upper case. It seems like you might have missed that bit of the instructions. It is possible to do this all on one line of code. And because you are so close here, I'm going to just leave these hints. But if you're still stuck, please let me know!
David Dehghani
6,992 PointsDavid Dehghani
6,992 PointsArgh, I'm so close I can taste it! I don't think I'm getting how to add both variables in one line to upper case.
This was my failed attempt:
var id = "23188xtr"; var lastName = "Smith";
var userName = id.toUpperCase() lastName.toUpperCase();
userName = id + "#" + lastName;
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherOh, still close! Take a look at how I did it.
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
This one line will take the id and uppercase it, then concatenate the pound sign/hash tag in the middle, then add the upper case version of lastName onto the end.
Good luck to you!
David Dehghani
6,992 PointsDavid Dehghani
6,992 PointsAh I see. I was making things more difficult for myself. Thanks for the help Jennifer! :)