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 trialSam Weeks
Front End Web Development Techdegree Student 16,699 Pointsnot sure where i'm going wrong...
Use the JavaScript .toUpperCase( ) string method to assign an all uppercase version of the id variable to the userName variable.
Bummer: The userName
variable is "23188XTR#lastName" not "23188XTR#SMITH".
app.js
index.html
var id = "23188xtr"; var lastName = "Smith"; ā var userName = (id.toUpperCase()); ā userName += "#lastName"; ā
var id = "23188xtr";
var lastName = "Smith";
var userName = (id.toUpperCase());
userName += "#lastName";
<!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>
1 Answer
John Lack-Wilson
8,181 PointsSo the problem here is that the last line of your code is concatenating the id in upper case with #lastName (the literal string).
The challenge wants you to concatenate the id (upper case) with a '#' and the value of the lastName (upper case) variable.
Consider the code below:
var fName = "Sam";
var lName = "Weeks";
var fullName = fName.toUpperCase() + " " + lName.toUpperCase();
The above variable fullName would be assigned "Sam Weeks".
Sam Weeks
Front End Web Development Techdegree Student 16,699 PointsSam Weeks
Front End Web Development Techdegree Student 16,699 Pointsstill confused thanks for helping though
Bummer: The
userName
variable is "23188XTR" not "23188XTR#SMITH". app.js index.htmlvar id = "23188xtr"; var lastName = "Smith"; ā var userName = (id.toUpperCase()); ā var fullName = id.toUpperCase() + "#smith" + lastName.toUpperCase();
John Lack-Wilson
8,181 PointsJohn Lack-Wilson
8,181 PointsOk so my example is using variables that you shouldn't be using in this challenge - it was to try and emphasise the point. You should continue to use userName, as that it what the challenge expects to see.
userName should contain this exact value: 23188XTR#SMITH
As the lastName variable contains "Smith", we can use this variable along with the .toUpperCase() method.
Here's an example:
The above code would result in the userName variable having the value: 2111OTF#WEEKS
Sam Weeks
Front End Web Development Techdegree Student 16,699 PointsSam Weeks
Front End Web Development Techdegree Student 16,699 Pointsi figured it out now with your code thanks John!
John Lack-Wilson
8,181 PointsJohn Lack-Wilson
8,181 PointsNo problem man, happy coding!
Sam Weeks
Front End Web Development Techdegree Student 16,699 PointsSam Weeks
Front End Web Development Techdegree Student 16,699 PointsYea i can see now you were trying to help by giving me a different example i just took your first bit of code as literal and got confused cheers mate understand it a bit clearer now