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

Sean Flanagan
Sean Flanagan
33,235 Points

Task 2

Where am I going wrong with the #? I can't find anything that requires the use of a #.

Cheers

Sean

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

3 Answers

Grace Kelly
Grace Kelly
33,990 Points

Hi Sean,

The task asks for a "#" inbetween the id and the username just add it and it should pass, like so:

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

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

Note in my code I added a toUpperCase() to the lastName variable as the end result should be "23188XTR#SMITH"

Sean Flanagan
Sean Flanagan
33,235 Points

Hi Grace. I've tried this but it's still not working.

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

I get a message saying "Did you add the '#' character between id and lastName?

Thanks

Sean

Grace Kelly
Grace Kelly
33,990 Points

Hmm, that's strange it works for me, although i've noticed i've made an error on the spelling of userName:

var userName = id.toUpperCase(); //changed spelling error here
userName = userName + '#' + lastName.toUpperCase();
Sean Flanagan
Sean Flanagan
33,235 Points

Hi Grace.

Just to let you it worked. Thanks for your help and you've earned a Best Answer for your troubles.

Sean :-)

Grace Kelly
Grace Kelly
33,990 Points

No worries Sean, glad I could help!! sorry for the error on my part, just goes to show even the smallest things can trip us up :s haha!!