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 trialGabriel E
8,916 PointsHow to concatenate the variables here?
Hi there, I'm not sure how to go about this challenge. I accomplished the first task easy enough, but the second is giving me trouble. I basically have to do just what the instructions say, but I'm not quite getting it. Could someone please help with this? Thanks!
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
assignment += "#";
var assignment = lastName + id.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>
3 Answers
Steven Parker
231,269 PointsYou had the right idea, string concatenation is done with the plus sign (+). I think you just got confused about the fact that you were still working on the assignment for userName. You want something like this:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Collin Perkins
8,811 PointsAll you need to do is add on to what you had in the first code assignment on the userName var through string concatenation.
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Gabriel E
8,916 PointsOk, I get it now. Thanks so much!
geoffrey
28,736 PointsDon't forget to mark the answer that helped you the most as best answer :)
Max Kutner
7,595 PointsMax Kutner
7,595 PointsHi,
Here is the code:
var userName = id.toUpperCase(); userName = userName + '#' + lastName.toUpperCase();
Hope it helps! Lemme know if it doesn't make sense!
Max