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 trialshawn khah
15,082 PointsCan't get the username declaration right.
Complete the assignment to the userName variable by adding a # symbol followed by an all uppercase version of the lastName variable. In other words, using string concatenation so that the final value of userName is "23188XTR#SMITH".
Bummer! You only need to call toUpperCase()
on id
and lastName
. Preview Get Help Recheck work
app.js
index.html
var id = "23188xtr"; var lastName = "Smith";
var userName = id.toUpperCase (); var userName = id.toUpperCase() + "#" + lastName.toUpperCase() 1 var id = "23188xtr"; 2 var lastName = "Smith"; 3 ā 4 var userName = id.toUpperCase (); 5 var userName = id.toUpperCase() + "#" + lastName.toUpperCase()
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase ();
var userName = id.toUpperCase() + "#" + lastName.toUpperCase()
<!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>
2 Answers
efewafewa
21,825 PointsIt looks like you have a space between your function and your parenthesis in your toUpperCase(); in your first line of code. Either way, having that line of code is messing up your second line of code.
So for the first part, of the challenge, you are going to want to take the space out of your code to go from this...
var userName = id.toUpperCase ();
to this...
var userName = id.toUpperCase();
Then for the second part, you are only going to add to the original line of code, not create a whole new line when you do the concatenation. You already had a passing line there, but just a reminder to throw a semicolon at the end there. I threw it in for you...
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
This should work for you! Let me know if you have any other questions!
elk6
22,916 PointsHi Shawn,
Try to do it all in one line of code. No need for the second var declaration.
Like this:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase()+ "#" + lastName.toUpperCase();
shawn khah
15,082 PointsTanks elian
shawn khah
15,082 Pointsshawn khah
15,082 Pointsthanks julian