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

Not Correct?

I am on the last part on challenging. Even words are displayed in UpperCase all of them and adding '#' between them, it's not working. Does anyone know how to solve this part? Help me

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

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

3 Answers

Erik McClintock
Erik McClintock
45,783 Points

Kenzo,

It isn't worded the best, but unless told otherwise, you need to keep code the same from task to task. Don't delete anything you did previously, and make sure you read the instructions carefully. For this task, you need to keep the call to the ".toUpperCase()" method on both your id and lastName variables.

Your userName variable should look like this...

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

...so that you get their instructed output of "23188XTR#SMITH".

Erik

Alternatively you could put .toUpperCase(); in the variable declarations like this:

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

Thanks for comments guys!! Those are really really helpful resources!! I'll be more careful with writing codes!!