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 trialRhiannon Sadler
351 PointsI am stuck on section two of my challenge
the code i have on the screen already is.
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
And the instruction i was given is
Finally, add a # symbol and lastName in uppercase to the end of the userName string. The final value of userName is "23188XTRSMITH"
var id = "23188xtr";
var lastName = "Smith";
var userName = id.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
Steve Hunter
57,712 PointsI'm late to the party; my version of the solution looked like this:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName = userName + "#" + lastName.toUpperCase();
Glad you got it sorted!
Steve.
Justin Radcliffe
18,987 PointsHi Rhiannon,
This will work:
var id = "23188xtr";
var lastName = "Smith";
var userName = id.toUpperCase();
userName += '#';
userName += lastName.toUpperCase();
In the last 2 lines of code we're concatinating the # symbol, then the lastName variable converted to upper case.
[MOD: edited code block - srh]
Rhiannon Sadler
351 Pointssheesh, thankyou. I this course is really stepping up its skills huh. i would have never worked that out no matter how many times i watched the video again. Thankyou!
Rhiannon Sadler
351 PointsRhiannon Sadler
351 PointsThankyou bud! still nice to look at alternatives to it was still a big help.
Steve Hunter
57,712 PointsSteve Hunter
57,712 PointsNo problem!
JS isn't 'my thing' but feel free to tag me in any posts you make in here and I will try to help. You can do that Twitter-style with the 'at' symbol - Rhiannon Sadler <- like that.
Rhiannon Sadler
351 PointsRhiannon Sadler
351 PointsWill do! :)
Steve Hunter
57,712 PointsSteve Hunter
57,712 Points