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

Is it frustrating on purpose?

I can't figure out the syntax the lesson is looking for. We are supposed to string id and lastName together with a # between the id and lastName and the whole thing is supposed to be in all caps. For some reason no matter how I write it the # is not recognized. What is the trick because I can not figure it out by watching the video or looking through the MDN JavaScript reference page.

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

var userName = id + "#" + lastName.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

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

You didn't upcase the id

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

I will try this, I was adding it all in one command then ending it .toUpperCase.

Hugo Paz
Hugo Paz
15,622 Points

If you want to call the method only once you can do it like so:

var userName = (id + "#" + lastName).toUpperCase();
Hugo Paz
Hugo Paz
15,622 Points

Hi Jeremiah,

You are supposed to have the id in caps too.

So you need to change your code to:

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

This is why its giving you an error on the #.

Thank you everyone for all the help! As I get farther on it just keeps getting a little tougher.