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 trialJerry Williamson
378 PointsI am not sure why I get the message, "Oops! It looks like Task 1 is no longer passing."
is there something wrong with "id" variable or with my solution?
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
var uplast = lastName.toUpperCase();
userName += "#" += uplast;
<!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
Ken Alger
Treehouse TeacherJerry;
- You need to reassign a value to userName, which 'userName + "#" + upperLast;` does not do.
- Using the code that Chris posted would work.
- You are using
lastname
in one location when it is defined aslastName
elsewhere.
userName += "#" + upperLast;
That sets userName
equal to itself with the concatenated addition of the reset of the code.
Ken
Chris Shaw
26,676 PointsHi Jerry,
You appear to have a minor syntax error in the last line of your code, instead of +=
after the hash you should have a single plus sign.
userName += "#" + uplast;
Jerry Williamson
378 PointsThanks, Chris, for the speedy reply! I still get the error "Oops! It looks like Task 1 is no longer passing." with this code.
var id = "23188xtr"; var lastName = "Smith";
var userName = id.toUpperCase(); var upperLast = lastname.toUpperCase(); userName + "#" + upperLast;
My error somewhere?
Jerry Williamson
378 PointsAwesome. Makes great sense and I thank you for the help!
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherYou could also do something like:
var userName = id.toUpperCase() + "#" + lastName.toUpperCase();
and take out the creation of another variable entirely.
Ken