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

How can I add two variables to an existing string?

I've been stuck on this challenge for ages and even went over the videos from the very beginning of Javascript again but I just can't solve this one. How can I make all these variables uppercase and a value for the userName string?

I hope my question is clear and if you know how it works, could you please provide an explanation as to how it works, so I can understand.

Thank you very much...

var id = "23188xtr";
var number = "#";
var lastName = "Smith";

var userName = id.toUpperCase();
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
<script src="app.js"></script>

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

Since we're being asked to add things to the end of userName it makes sense for the next line to start off with:

userName = userName +

Then fill in what you want to add onto the end of the current string. Hopefully this is enough to get you started in the right direction.

Yes thank you so much Seth, I was able to figure it out with your help. I am still confused by the challenge but hopefully I will have an "aha" moment as I carry on.