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 trialRyan Reynolds
Courses Plus Student 932 PointsI can't figure out this question. var id = "23188xtr"; var lastName = "Smith"; var new = id.toUpperCase(); var use
Can you help out with this. I cant quite figure it out.
var id = "23188xtr";
var lastName = "Smith";
var new = id.toUpperCase();
var userName
new += 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>
3 Answers
Tijo Thomas
9,737 PointsThe challenge states "Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable". The code they give you is the following:
var id = "23188xtr";
var lastName = "Smith";
var userName
There is no need to create/declare a "new" variable as you did on line 3. On line 5 you are appending the userName variable to the new variable you created, but userName does not have a value, so new remains unchanged. Also, you didn't capitalize the n in username on line 5 which will probably throw an undefined error. All you need to is assign the uppercased value of id to the given userName variable as I've shown below.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
Steven Parker
231,248 PointsIt looks like you assigned to the wrong variable.
You seem to have correctly created an all uppercase version of the id variable, but you assigned it to a variable named "new" instead of the one named "userName" as requested by the challenge. There's also some extra stuff that does't seem related to the challenge.
You may also want to review the videos on Combining Strings and Working with Strings and Finding Help.
Ryan Reynolds
Courses Plus Student 932 PointsThanks. I finally figured it out. I just didnt quite understand the question and was making it more difficult than i should have.
Thanks!