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 trialCameron Gates
3,821 PointsJS Basics Code Challenge Problems
Can some help me understand what I am doing wrong? I have run out of ideas. Thanks!
var id = "23188xtr";
var lastName = "Smith";
alert(id.toUpperCase());
var userName = "23188xtr#" + "Smith";
alert(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>
4 Answers
Simon Coates
28,694 Pointsvar userName = id.toUpperCase() + "#"+lastName.toUpperCase();
Steven Parker
231,248 PointsThe challenge is based on variable assignments. Adding alerts may confuse the checking mechanism.
Simon's solution to task 2 is correct, but it's worth pointing out that each variable is converted separately to upper case, and the final string is created by concatenation (using "+") of the two variables with "#" in between.
Philipp Schweizer
4,501 PointsI am getting this error code: The userName
variable is "23188XTR#SMITH" not "23188XTR#SMITH". Which is confusing because they are the same.
Simon Coates
28,694 Pointsif you're still getting this, suggest posting your code to see if there's anything weird. If there isn't, then you might have stumbled across a bug and you should take a screenshot and send to support.
Philipp Schweizer
4,501 PointsI got it to work with the help of the forum. :)