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 don't understand what it wants me to do.

Javascript

app.js
var id = "23188xtr";
var lastName = "Smith";

var userName = id.toUpperCase();
var += "#smith";
console.log(userName);
index.html
<!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

Leandro Botella Penalva
Leandro Botella Penalva
17,618 Points

Hi Yisroel,

You've got the first task which is to put the id variable in uppercase to the userName variable. The next thing you have to do is to that userName variable concatenate to itself a pound symbol (#) and then the contents of the lastName variable but in uppercase. You don't have to use the console.log

You may want to check the Combining String lesson if you have any doubts on how to concatenate strings.

I have looked over the video ad still have not been able to complete this challenge.

Leandro Botella Penalva
Leandro Botella Penalva
17,618 Points

To concatenate something you use the "+" operator so to concatenate the # symbol you just use:

var userName = id.toUpperCase() + "#";

Now you also need to concatenate the lastName value in uppercase to the existing line so let's just add the lastName in uppercase form:

var userName = id.toUpperCase() + "#" + lastName.toUpperCase();

So the entire task would be:

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

var userName = id.toUpperCase() + "#" + lastName.toUpperCase();