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

Ricardo Felix
Ricardo Felix
5,828 Points

i am having an issue with the second task in the second section of my challenge 2 of 2

Every time I go to the second secton of the task the first section no longer works

app.js
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() += lastName += "#";
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>

2 Answers

filipz
filipz
11,063 Points

Hi Ricardo, the challenge is asking to combine variables and strings together and store them in the variable userName. You got the first part right, which was storing id.toUpperCase() but then it says to add the symbol first then the lastName in uppercase. The final code should look like this, hope this helps!

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

hey ricardo,

so the second challenge asks you to add the # and the lastName all upper case to the string so it looks like this 23188XTR#SMITH

so first you add the id to uper case to get '23188XTR' then add the pound so you just need the string '#' and lastly add the last name to upper case to look like this 'SMITH' . when you put it all together it should look like this '23188XTR#SMITH' remember that at the end it is suppose to be all one string so all of it needs to be in (). like this

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

hope this helped