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

Amy McKnight
Amy McKnight
10,124 Points

Trying to make a compound variable. When I add what I thought was the answer. It isn't &/or the 1st task stops working.

I'm having some troubles with this code challenge. Going to rewatch the video 3rd time :-( any help would be apprecated!

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

var userName = id.toUpperCase();
userName += id + "#" + 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>

6 Answers

Amy McKnight
Amy McKnight
10,124 Points

Yes, Thanks again. Love this place!

Amy McKnight
Amy McKnight
10,124 Points

I found it!

I was inserting a

;

after the first toUpperCase !

Wow. Thanks you all for bearing with me.

All the best

Julian Aramburu
Julian Aramburu
11,368 Points

Yay :D! Great you found it yourself! Training the eye for typo/misspell catching would turn your daily coding routine so much easier :D!

Cheers and Keep Coding!

Julian Aramburu
Julian Aramburu
11,368 Points

Hi Amy! You got the first task right! Great :D!

In the second one, you are supposed to keep concatenating variables in the same way but you must set the lastName to upper case and add a hashtag before... but you are concatenating "username" I think that's what's causing the error ...also you can concatenate everything in only one sentence like this:

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

Hope you find this answer useful!

Cheers and Keep Coding!

Colin Marshall
Colin Marshall
32,861 Points

It wants you to add on to the var username line in the first task. You are also adding the username value at the end incorrectly. You should be adding an uppercase version of the lastName value at the end. It should look like this:

var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Amy McKnight
Amy McKnight
10,124 Points

Wanted to celebrate but it isn't taking it.

I added this code:

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

but I'm still getting this message:

"Bummer! Did you add the '#' character between id and lastName?"

YES, I did :-(

is it a bug or me?

Colin Marshall
Colin Marshall
32,861 Points

The entire answer to step 2 should look like this:

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

var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Julian Aramburu
Julian Aramburu
11,368 Points

Did you write username in your code as well? Because it should be "userName" with uppercase N.

Amy McKnight
Amy McKnight
10,124 Points

yes

<code>var userName = id.toUpperCase(); + "#" + userName.toUpperCase();</code>

Julian Aramburu
Julian Aramburu
11,368 Points

oh i spotted the typo! Delete the semicolon from the first toUpperCase call and it should work properly :)!