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 trialHafeez Sumani
3,557 PointsI need help with this one ? where is the answers
I need some help with this challenge please. What I'm missing here.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
lastName.toUpperCase();
userName += "#"+ 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
Jason Wiram
42,762 PointsThere are a couple things to note here.
The last line of code in app.js uses
LastName
as a variable but the name of the variable created in the code islastName
.More importantly, when you call
lastName.toUpperCase();
you are saving the result of that call anywhere. A possible solution would be to calllastName = lastName.toUpperCase();
Then if you updated your last line of code to uselastName
it should work.
Mark Miller
45,831 PointsMark Miller
45,831 PointsThe problem is in the line where you call toUpperCase() on lastName, because you are not assigning that to be the value of anything. So that line is just an expression, and its value is dropped when the processing moves to the next line. You have choices on how to fix it. You can assign the value of lastName.toUpperCase() to lastName by assignment with the = symbol. Or you can just one-line it on the userName assignment, which is best because the challenge does not say to permanently change lastName to upper case. So, use toUpperCase() in the same line where lastName is assigned to user name, all in one line.