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 trialEmily Reger
1,564 Pointsis the correct command userName += "#"; ? Where do I put it in the sequence?
I am a little stumped :/
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
lastName.toUpperCase();
userName += "#";
<!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
Abe Layee
8,378 PointsFor the second part of the challenge, you have to use the toUpperCase() method on both id and lastName and keep the hash # in the middle with quotation mark around it. Something like
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() +"#" + lastName.toUpperCase();
Jason Anders
Treehouse Moderator 145,860 PointsHi Emily, Abraham is right, but to answer your question about += ... That is the symbol used when you want to add to (either an incremental value or a string) to a variable.
For an incremental value example
var a = 2;
a += 4; //the variable will now equals 6
For adding strings example
var a = "Hello";
a += " "; // a space
a += "World!" // the variable will now be the string "Hello World!"
I hope that helps you.
Jason :)