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 trialASHLEY HAYES
8,646 PointsAdding to a string
The first question asked to declare a variable and turn the string into uppercase. var userName = id.toUpperCase(); var userName
The next step asks you to add "#" and the variable lastName to the end of the username string.
var userName = id.toUpperCase + "#" + lastname.toUpperCase(); var userName
I keep running into an error and cannot figure out how to get the variable userName to return the id number plus "#" plus lastName in all uppercase.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase + "#" + lastname.toUpperCase();
var 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>
3 Answers
Abraham Juliot
47,353 PointsYou got this. Just a typo and a redeclaration not needed at the end
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase() + "#" + lastName.toUpperCase(); // note, lastName with a capital N
// no need to redeclare var userName; at the end as that would make userName a null value;
Kevin Han
92 Pointsremove your last line of code
ASHLEY HAYES
8,646 Pointsvar userName?
ASHLEY HAYES
8,646 PointsThank you!!
ASHLEY HAYES
8,646 PointsASHLEY HAYES
8,646 PointsI've tried that answer and it keeps telling me that my task1 is no longer passing. Which was declaring userName with just the id and .toUppercase method. So confused!
Abraham Juliot
47,353 PointsAbraham Juliot
47,353 Pointssorry, forgot to mention make sure to include parenthesis () to both toUpperCase methods.
I've been coding for years, and I make that mistake frequently on the toUpperCase() method. :)