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 trialFinn MacLean
2,945 PointsConcatenation error
Having trouble getting past this task, as it appears my Concatenation is not working? (not seeing my added # symbol)
var id = "23188xtr"; id += "#"; var lastName = "Smith"; var userName = id.toUpperCase(); lastName.toUpperCase();
Any advice appreciated folks, I have gone back through the videos but guessing i have not assigned it in the correct place.
cheers,
var id = "23188xtr";
id += '#';
var lastName = "Smith";
var userName = id.toUpperCase();
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>
2 Answers
Sean T. Unwin
28,690 PointsSorry, I didn't see that this was part of a code challenge.
You haven't assigned lastName
to userName
.
The following is my result which passed:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName += '#' + lastName.toUpperCase();
Good luck and happy coding. :)
Finn MacLean
2,945 PointsAwesome thank you!
Sean T. Unwin
28,690 PointsYou need to assign lastName.toUpperCase()
to a variable, like you did with id
, as strings are immutable.
You can simply change the last line to the following and it will be fine:
lastName = lastName.toUpperCase();
Finn MacLean
2,945 Pointsthanks for the swift answer. I did the same and checked with the Chrome console and it executed fine. Yet still get that error within the 'quiz section' just to check I have your suggestion correct:
var id = "23188xtr"; id += '#'; var userName = id.toUpperCase(); var lastName = "Smith"; lastName = lastName.toUpperCase();
thanks for your help though, much appreciated :-)
Sean T. Unwin
28,690 PointsSean T. Unwin
28,690 PointsEdit: See below I noticed an issue afterwards with
lastName
It works fine for me when I tested in Firefox's Scratchpad.
I tested: