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

i literally spent 1 hour trying to figure this out

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

the code only outputs lower case letters besides the S. i need to make sure that the username outputs all in cap letters and with # in the middle of the id and last name. what am i doing wrong?

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

8 Answers

The line above "lastname.toUpperCase()" is missing a semi-colon. Otherwise your code looks good.

i did that and it still says its not upper case. thanks for the reply though.

i think im doing it correctly but it literally keeps telling me this

Bummer! The userName variable is "23188xtr#Smith" not "23188XTR#SMITH".

I got it to work by using: id=id.toUpperCase(); and lastName=lastName.toUpperCase();

I think I used the method when I put the string together: userName = (id.toUpperCase() + "#" + lastName.toUpperCase()); It looks like you have to put it back into the variable with the "=" if you do it in a separate step.

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

Bummer! The userName variable is "23188XTR#SMITH" not "23188XTR#SMITH".

lol this is weird. do i have to put uppercase method after i already declared the new value? thanks for answering!

That error message makes no sense at all!

It looks like you have both id.toUpperCase(); AND id=id.toUpperCase(); (same with the last name...)

Get rid of the extra lines (the two without "=") and see how the program likes it then...

it worked! wow i think that means im friend for the night already. thanks so much for the fast replies you are amazing! is this a sign that coding isnt for me?

No, it happens all the time, and to everyone once in a while. The more mistakes you make, the more you learn. I wouldn't be able to help if I hadn't made the same mistakes myself.