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 trialMax Turner
Full Stack JavaScript Techdegree Student 3,904 PointsNot sure where I am going wrong. I've tried approaching this in a few ways.
Not sure where I am going wrong. I've tried approaching this in a few ways and don't know why the <var userName> is appearing as "23188XTR#Smith". The "#" is appearing and I have no idea why.
var id = "23188xtr";
var lastName = "Smith";
var string = id.toUpperCase()+lastName;
var userName = string;
<!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>
3 Answers
KRIS NIKOLAISEN
54,971 PointsYou need to concatenate the # yourself as follows:
var id = "23188xtr";
var lastName = "Smith";
var string = id.toUpperCase()+'#'+lastName.toUpperCase();
var userName = string;
Brandon Evanson
9,482 Pointsvar id = "23188xtr"; var lastName = "Smith";
// this takes id variable and upper cases it. Then concatenates # sign. Last step is to concatenate the lastName variable // so it is also upper cased var userName = id.toUpperCase() + '#' + lastName.toUpperCase();
Max Turner
Full Stack JavaScript Techdegree Student 3,904 PointsThanks so much for responding. There's nothing in the directions wanting me to concatenate with a "#", just to "Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable." But maybe I misunderstood it. I'll give this a try!
KRIS NIKOLAISEN
54,971 PointsConcatenating # and last name is for task 2 which is what it appeared you were working on. Task 1 is just converting id to upper case and assigning that to userName - so you'd remove +lastName from what you have above. The bummer message you received is misleading.
Max Turner
Full Stack JavaScript Techdegree Student 3,904 PointsAh, that makes much more sense. I misunderstood what it was wanting me to do in step one. I followed your directions and was able to move on to step 2, which was obviously then the same code. All is well! I understood the lesson, just got confused on the wording of the question. Thanks for your help!
Max Turner
Full Stack JavaScript Techdegree Student 3,904 PointsMax Turner
Full Stack JavaScript Techdegree Student 3,904 PointsThanks so much for responding. There's nothing in the directions wanting me to concatenate with a "#", just to "Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable." But maybe I misunderstood it. I'll give this a try!