Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Daniel Glennie
42,854 PointsWhy won't this concatenation work? I have tried += and x + y + z formatting.
I have created a variable called userName and assigned the output of toUpperCase(id). I have tried to add the # and SMITH like this
var userName = String.prototype.toUpperCase(id) + "#" + String.prototype.toUpperCase(lastName);
and like this var userName = String.prototype.toUpperCase(id); userName += "#"; userName += String.prototype.toUpperCase(lastName);
What am I missing?
var id = "23188xtr";
var lastName = "Smith";
var userName = String.prototype.toUpperCase(id);
userName += "#";
userName =+ String.prototype.toUpperCase(lastName);
<!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>
1 Answer

Jennifer Nordell
Treehouse TeacherHi there! In your last line, you have the + and equals signs backwards. It should be +=
. But even if I change that, the challenge still fails. You ned to run the toUpperCase
method directly on the string in question.
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
Hope this helps!
edited for accuracy and additional information
Here's the MDN documentation:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase
Daniel Glennie
42,854 PointsDaniel Glennie
42,854 PointsThank you! I noticed the += was the wrong way round right as soon as I posted the question but that didn't fix the problem. It seemed as if the final value assigned to userName was just "#" but I can't think why that would be.