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 trialMatthew Bell
1,170 PointsI'm stumped on a challenge... What am I doing wrong?
http://www.screencast.com/t/tXhvxz776QA
var id = "23188xtr";
var lastName = "Smith";
var stringToShout = id.toUpperCase();
lastName.toUpperCase();
var 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>
4 Answers
David Axelrod
36,073 PointsHey Matt!
it looks like you're performing the right operations, just not storing them in the proper variable. For example, your stringToShout variable is the one that's uppercased. The id variable was left unchanged. Same for the the name except it wasn't assigned to any variable. In the code below, I just did all the functions on the username variable. Hope this helps!!
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() +'#' +lastName.toUpperCase();
David McCarty
5,214 PointsIt's as simple as changing
var id = "23188xtr";
var lastName = "Smith";
to
var id = "23188XTR";
var lastName = "SMITH";
I used your code and just changed these two variables and it worked for me!
It should look like this
var id = "23188XTR";
var lastName = "SMITH";
var stringToShout = id.toUpperCase();
lastName.toUpperCase();
var userName = id + '#' + lastName;
However, I believe you only need to change "xtr" to "XTR" since you uppercase the lasename.
I've found that the Treehouse code checking really wants the strings to look exactly the same, so even a change in case is considered incorrect.
David Axelrod
36,073 Pointshaha we posted at the exact same time
David McCarty
5,214 PointsHaha yes we did
Ira Bradley
12,976 PointsHi Matthew,
You are over-complicating this just a bit but you have all the correct pieces. You can use the .toUpperCase()
method while assigning the userName variable.
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
If you do it this way you don't need any intermediate steps.
Matthew Bell
1,170 PointsWhoah. Thanks all! I was wayyyy overcomplicating it. Part of being a noob to JavaScript.
Thanks!
David McCarty
5,214 PointsGlad you got it worked out.
Feel free to set one of the answers that helped you the most as the best answer so others with a similar problem can get a quick answer :)
Matthew Bell
1,170 PointsDone!