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

?? Don't know what I am doing wrong with this .toUpperCase() obbjective

Everything I do it was asking me if I was using .toUpperCase with lastName (which I was) - I have tried everything so many times I and it kept repeating "did you add .toUpperCase() to end of lastName, which I had, so I started playing with the semi-colons, etc. to where it now says "task 1 doesn't work "- I can't even remember what task one was since I've been dealing with this for so long. I have gone back & watched the video & paused it on the section where Dave types it out - to no avail . Is there a bug in this challenge or something?

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

var userName = id.toUpperCase(); + "#" + 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>
Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Besides the syntax errors, you'll need to show two statements to complete the challenge. I updated my answer.

2 Answers

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Yep, a couple of syntax errors - remove the semicolon after id and spell lastName correctly. Copy it into your browser to debug.

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

If you follow the challenge they have you to add the # (pound sign) and upper case to the userName defined in task 1. So you need to show the completed task 1 and a separate statement for task 2 - something like below:

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

Thanks so much for the timely reply! By the time I asked for help - my page wasn't even showing what I was actually doing wrong - but you answered all of it, Thanks, again!

Hi there, you just made a little syntax error in your concatenation in the 'username' variable. You typed a semi-colon in between the .toUpperCase() method and the '#' string, and you didn't spell 'lastName' correctly.

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

All you need do is delete the semi-colon and spell the 'lastName' variable correctly with camel casing and you're good to go :)

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

Thak you, Osaro - I just tried the same answer you gave me (which I am pretty sure I tried during this whole period) and it still does not work. Dave sent me the same answer, told me to copy/paste it - I did it still does not work?!?! Thank you!!