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 trialJared Cordero
1,228 PointsTask 2 not working
I had watched the videos over and over multiple times and none cover this topic. I used the hashtag and just get a syntax error.
var id = "23188xtr";
var lastName = "Smith";
console.log(id.toUpperCase())
console.log(lastName.toUpperCase())
var userName = '23188XTR#SMITH';
<!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
Jason Anders
Treehouse Moderator 145,860 PointsHi Jared,
Task one asks to to convert the id to an all Upper Case variable. There is no need for console.log. To covert a variable to Upper Case, you use the .toUpperCase() method on the variable. So, instead of console.log, your first task would be:
var userName = id.toUpperCase();
In the second task, you are pretty much asked to do the same thing, but you have to use concatenation to join the two variables into on, as well as using the .toUpperCase() method within the concatenation.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName = userName + "#" + lastName.toUpperCase();
I hope this clears things up a bit. But I would recommend going back and watching the video "Combining Strings" again to make sure it really makes sense. This will become important in future lessons.
I've often watched a video a couple of times before moving on.
Keep coding! Jason :)
Jonathan Leon
18,813 PointsYou're missing semicolons on line 3 and 4 in your javascript (;)
Abe Layee
8,378 PointsThe challenge is not asking you to console.log id and lastName. You have to add toUpperCase() method on both id and lastName while you keep the hash # in the middle of the code. Something like this.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() +"#" + lastName.toUpperCase();