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 trial

JavaScript JavaScript Basics (Retired) Storing and Tracking Information with Variables Using String Methods

I 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();

userName += "#"+ LastName
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="app.js"></script>
Mark Miller
Mark Miller
45,831 Points

The 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.

1 Answer

Jason Wiram
Jason Wiram
42,762 Points

There are a couple things to note here.

  1. The last line of code in app.js uses LastName as a variable but the name of the variable created in the code is lastName.

  2. More importantly, when you call lastName.toUpperCase(); you are saving the result of that call anywhere. A possible solution would be to call lastName = lastName.toUpperCase(); Then if you updated your last line of code to use lastName it should work.